forked from sergiogama/wa-d1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
25 lines (20 loc) · 793 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
const path = require("path")
const express = require("express");
const bodyParser = require("body-parser");
const cors = require('cors');
const conversationRouter = require('./routes/assistant-routes.route');
const configRouter = require('./routes/config-routes.route');
const app = express();
app.set('port', process.env.PORT || 8080);
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
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')} `);
})