forked from AdityaKotari/flush
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (19 loc) · 682 Bytes
/
index.js
File metadata and controls
28 lines (19 loc) · 682 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
const express = require('express')
const app = express()
const path = require('path');
require('dotenv').config();
const router = (global.router = (express.Router()));
const port = process.env.PORT || 5000;
var cors = require('cors')
// app.use(cors());
app.use(express.json());
app.use('/api/profile', require('./routes/profile.js'));
app.use('/api/toilet', require('./routes/toilet.js'));
app.use(router);
app.use(express.static(path.join(__dirname, 'client/build')));
app.get('*', (req,res) =>{
res.sendFile(path.join(__dirname+'/client/build/index.html'));
});
app.listen(port, () => {
console.log(`Flush server listening at http://localhost:${port}`);
});