You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
767 B

const express = require('express');
import get_knex from './knex/get_knex';
import { SetupApp } from './app';
const app = express();
const knex = get_knex();
(async () => {
await knex.raw('PRAGMA foreign_keys = ON');
await knex.migrate.latest();
const port = process.env.PORT || 5000;
const apiBase = process.env.API || "";
const frontEndPrefix = process.env.FRONTEND_PREFIX || undefined;
const frontEnd = process.env.FRONTEND || undefined;
SetupApp(app, knex, apiBase);
if(frontEnd && frontEndPrefix) {
console.log(`Hosting front-end ${frontEnd} at ${frontEndPrefix}.`)
app.use(frontEndPrefix, express.static(frontEnd))
}
app.listen(port, () => console.log(`Listening on port ${port}`));
})()
export { }