syntax enforcing
This commit is contained in:
+14
-14
@@ -1,9 +1,9 @@
|
||||
import { Kysely, PostgresDialect } from "kysely";
|
||||
import { Pool } from "pg";
|
||||
import migrateToLatest from "./migrations";
|
||||
import Database, { KillTable } from "./model";
|
||||
import { Kysely, PostgresDialect } from 'kysely'
|
||||
import { Pool } from 'pg'
|
||||
import migrateToLatest from './migrations'
|
||||
import Database, { KillTable } from './model'
|
||||
|
||||
const migration = migrateToLatest();
|
||||
const migration = migrateToLatest()
|
||||
// You'd create one of these when you start your app.
|
||||
const db = new Kysely<Database>({
|
||||
// Use MysqlDialect for MySQL and SqliteDialect for SQLite.
|
||||
@@ -12,10 +12,10 @@ const db = new Kysely<Database>({
|
||||
host: process.env.POSTGRES_HOST,
|
||||
database: process.env.POSTGRES_DATABASE,
|
||||
user: process.env.POSTGRES_USER,
|
||||
password: process.env.POSTGRES_PASSWORD,
|
||||
}),
|
||||
}),
|
||||
});
|
||||
password: process.env.POSTGRES_PASSWORD
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
export async function CreateKillRecord({
|
||||
server,
|
||||
@@ -24,12 +24,12 @@ export async function CreateKillRecord({
|
||||
weapon,
|
||||
map,
|
||||
distance,
|
||||
date,
|
||||
date
|
||||
}: KillTable) {
|
||||
await db
|
||||
.insertInto("kill")
|
||||
.insertInto('kill')
|
||||
.values({ server, attacker, victim, weapon, map, distance, date })
|
||||
.execute();
|
||||
.execute()
|
||||
}
|
||||
/*
|
||||
async function demo() {
|
||||
@@ -57,6 +57,6 @@ async function demo() {
|
||||
}
|
||||
*/
|
||||
export default async function ready(): Promise<Kysely<Database>> {
|
||||
await migration;
|
||||
return db;
|
||||
await migration
|
||||
return db
|
||||
}
|
||||
|
||||
+17
-17
@@ -1,23 +1,23 @@
|
||||
import * as dotenv from "dotenv";
|
||||
dotenv.config();
|
||||
import express from "express";
|
||||
import client from "./client";
|
||||
import db from "./db/db";
|
||||
import server from "./server";
|
||||
import * as dotenv from 'dotenv'
|
||||
dotenv.config()
|
||||
import express from 'express'
|
||||
import client from './client'
|
||||
import db from './db/db'
|
||||
import server from './server'
|
||||
|
||||
console.log("dotenv");
|
||||
console.log(db);
|
||||
console.log('dotenv')
|
||||
console.log(db)
|
||||
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
const app = express()
|
||||
const port = 3000
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.send("Hello World!");
|
||||
});
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello World!')
|
||||
})
|
||||
|
||||
app.use("/register", server);
|
||||
app.use("/api", client);
|
||||
app.use('/register', server)
|
||||
app.use('/api', client)
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening on port ${port}`);
|
||||
});
|
||||
console.log(`Example app listening on port ${port}`)
|
||||
})
|
||||
|
||||
+9
-9
@@ -1,10 +1,10 @@
|
||||
import { Router } from "express";
|
||||
const router = Router();
|
||||
import { Router } from 'express'
|
||||
const router = Router()
|
||||
//auth middleware
|
||||
router.post("/*", (req, res, next) => {
|
||||
next();
|
||||
});
|
||||
router.post("/*", (req, res, next) => {
|
||||
next();
|
||||
});
|
||||
export default router;
|
||||
router.post('/*', (req, res, next) => {
|
||||
next()
|
||||
})
|
||||
router.post('/*', (req, res, next) => {
|
||||
next()
|
||||
})
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user