-
Notifications
You must be signed in to change notification settings - Fork 62
/
app.js
27 lines (22 loc) · 863 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
const path = require("path")
const express = require("express");
const bodyParser = require("body-parser");
const cors = require('cors');
const cookieParser = require('cookie-parser')
const conversationRouter = require('./routes/assistant-routes.route');
const configRouter = require('./routes/config-routes.route');
const app = express();
app.set('port', process.env.PORT || 4000);
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser())
app.use('/api/v1/assistant', conversationRouter);
app.use('/api/v1/', configRouter);
app.use("/", express.static(path.join(__dirname, "public")));
app.use((req, res, next) => {
res.sendFile(path.join(__dirname, "public", "index.html"));
});
app.listen(app.get('port'), '0.0.0.0', () => {
console.log(`Server starting on => ${app.get('port')} `);
})