split express app from index file to make testing easier
This commit is contained in:
@@ -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";
|
import {SERVER_PORT} from "./config";
|
||||||
|
import app from "./server";
|
||||||
dotenv.config();
|
|
||||||
|
|
||||||
const app = express();
|
|
||||||
app.use(bodyParser.json());
|
|
||||||
|
|
||||||
// Configure routes
|
|
||||||
routes.register(app);
|
|
||||||
|
|
||||||
// start the Express server
|
// start the Express server
|
||||||
app.listen(SERVER_PORT, () => {
|
app.listen(SERVER_PORT, () => {
|
||||||
|
|||||||
15
backend/src/server.ts
Normal file
15
backend/src/server.ts
Normal 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;
|
||||||
Reference in New Issue
Block a user