-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
36 lines (28 loc) · 887 Bytes
/
app.js
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
32
33
34
35
36
require("dotenv").config();
const express = require("express");
const App = express();
const cors = require("cors");
const PORT = process.env.PORT || 8080;
const logger = require("morgan");
const routes = require("./src/routes");
const errorHandler = require("./src/middleware/errorHandler");
App.use(logger("dev"));
App.use(cors());
App.use(express.urlencoded({ extended: "false" }));
App.use(express.json());
App.use(routes);
App.use(errorHandler);
App.get("/", (req, res) => {
return res
.status(200)
.json({ status_message: `BAKO_ABAH_SRV is running on port ${PORT}` });
});
// Define the static file path
App.use(express.static(__dirname + "/public/uploads"));
App.get("/", function (req, res) {
res.sendFile(__dirname + "/index.html");
});
App.listen(PORT, () => {
console.log(`This Server running on port : ${PORT}`);
});
module.exports = App;