-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (23 loc) · 710 Bytes
/
index.js
File metadata and controls
32 lines (23 loc) · 710 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
32
const {ENV,config} = require('./api/config.js');
const express = require('express');
const {routerApi} = require('./api/routes');
const cors = require("cors");
const {corsOptions} = require("./api/middlewares/cors.handler");
const {setCustomMiddlewares} = require("./api/middlewares");
const app = express();
const port = ENV.PORT || 3000;
// parsing json middleware
app.use(express.json());
// defining cors
app.use(cors(corsOptions));
app.get('/', (req, res) => {
res.send("Genzai with Express on Vercel")
})
// defining routes
routerApi(app);
// defining custom middlewares
setCustomMiddlewares(app);
app.listen(port, () => {
console.log(`Listening on port :${port}`);
})
module.exports = app;