-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (25 loc) · 700 Bytes
/
index.js
File metadata and controls
31 lines (25 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import routes from "./db/routes";
import winston from "winston";
import logging from "./startup/logging";
import morgan from "morgan";
import express from "express";
const app = express();
// middleware
app.use(express.json());
app.use(morgan("tiny"));
// startup configuration
routes(app);
logging();
// Not found middleware
// eslint-disable-next-line no-unused-vars
app.use((req, res, next) => {
res.status(404).send({ message: "Endpoint not found." });
});
// call to express server
// eslint-disable-next-line no-undef
const port = process.env.PORT || 3000;
const server = app.listen(port, () => {
winston.info(`CONNECTED TO PORT ${port}`);
});
// for testing
module.exports = server;