split express app from index file to make testing easier

This commit is contained in:
Bilal Catic
2020-02-17 18:20:30 +01:00
parent 1da514d9aa
commit 742f1baba4
2 changed files with 16 additions and 13 deletions

View File

@@ -1,17 +1,5 @@
import express from "express";
import dotenv from "dotenv";
import * as bodyParser from 'body-parser';
import * as routes from "./routes"
import {SERVER_PORT} from "./config";
dotenv.config();
const app = express();
app.use(bodyParser.json());
// Configure routes
routes.register(app);
import app from "./server";
// start the Express server
app.listen(SERVER_PORT, () => {

15
backend/src/server.ts Normal file
View File

@@ -0,0 +1,15 @@
import express from "express";
import dotenv from "dotenv";
import * as bodyParser from 'body-parser';
import * as routes from "./routes"
dotenv.config();
const app = express();
app.use(bodyParser.json());
// Configure routes
routes.register(app);
export default app;