add tests for #10
This commit is contained in:
+9
-5
@@ -18,10 +18,14 @@ app.get('/', (req, res) => {
|
||||
|
||||
app.use('/', client)
|
||||
|
||||
dbReady().then((e) => {
|
||||
cacheReady().then((e) => {
|
||||
app.listen(port, '0.0.0.0', () => {
|
||||
console.log(`Tone client api listening on port ${port}`)
|
||||
export default
|
||||
new Promise((resolve, reject) => {
|
||||
dbReady().then((e) => {
|
||||
cacheReady().then((e) => {
|
||||
const listenServer = app.listen(port, '0.0.0.0', () => {
|
||||
console.log(`Tone client api listening on port ${port}`)
|
||||
resolve(listenServer)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
import * as dotenv from 'dotenv'
|
||||
dotenv.config()
|
||||
import { InsertObject, Kysely, PostgresDialect } from 'kysely'
|
||||
import { Pool } from 'pg'
|
||||
import migrateToLatest from './migrations'
|
||||
import Database, { KillTable } from './model'
|
||||
|
||||
const migration = migrateToLatest()
|
||||
const db = new Kysely<Database>({
|
||||
dialect: new PostgresDialect({
|
||||
|
||||
@@ -9,7 +9,6 @@ import * as path from "path";
|
||||
import { Pool } from "pg";
|
||||
import Database from "./model";
|
||||
|
||||
console.log(process.env.POSTGRES_HOST);
|
||||
async function migrateToLatest() {
|
||||
const db = new Kysely<Database>({
|
||||
dialect: new PostgresDialect({
|
||||
|
||||
+6
-5
@@ -4,8 +4,9 @@ import { dbReady } from './db/db'
|
||||
import { cacheReady } from './cache/redis'
|
||||
import processAll from './client/process'
|
||||
|
||||
dbReady().then((e) => {
|
||||
cacheReady().then((e) => {
|
||||
processAll()
|
||||
})
|
||||
})
|
||||
async function startup() {
|
||||
await dbReady()
|
||||
await cacheReady()
|
||||
await processAll()
|
||||
}
|
||||
export default startup()
|
||||
+11
-4
@@ -2,7 +2,7 @@ import * as dotenv from 'dotenv'
|
||||
dotenv.config()
|
||||
import express from 'express'
|
||||
import cors from 'cors'
|
||||
import { dbReady } from './db/db'
|
||||
import db, { dbReady } from './db/db'
|
||||
import server from './server/server'
|
||||
|
||||
const app = express()
|
||||
@@ -17,8 +17,15 @@ app.get('/', (req, res) => {
|
||||
|
||||
app.use('/', server)
|
||||
|
||||
dbReady().then((e) => {
|
||||
app.listen(port, '0.0.0.0', () => {
|
||||
console.log(`Tone server api listening on port ${port}`)
|
||||
export default new Promise((resolve, reject) => {
|
||||
dbReady().then((e) => {
|
||||
const listenServer = app.listen(port, '0.0.0.0', () => {
|
||||
console.log(`Tone server api listening on port ${port}`)
|
||||
resolve(listenServer)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
app.on('close', () => {
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user