-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (21 loc) · 664 Bytes
/
app.js
File metadata and controls
27 lines (21 loc) · 664 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
require('dotenv').config();
const express = require('express');
const cors = require('cors')
const app = express();
const bodyParser = require('body-parser');
const router = require('./Router/route')
const path = require('path')
const https = require('https');
const port = process.env.PORT || 3001;
app.use(cors())
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'Frontend')))
// Call the routers
app.use(router);
app.get('/', (req, res) => {
res.status(200).sendFile(path.join(__dirname, 'Frontend', 'index.html'));
})
// Start the server
app.listen(port, () => {
console.log(`Server running at http://localhost:${port}`);
});