-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (25 loc) · 1.03 KB
/
index.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
28
29
30
const express = require('express'),
morgan = require('morgan');
bodyParser = require('body-parser')
cookieParser = require('cookie-parser'),
path = require('path');
const app = express();
app.use(morgan('tiny'));
app.use(bodyParser.json());
app.use(cookieParser());
app.use('/api/sms', require('./routes/sms'));
app.use('/api/appointments', require('./routes/appointment'));
app.use('/api/users', require('./routes/user'));
app.use('/api/patients', require('./routes/patient'));
app.use('/api/treatments', require('./routes/treatment'));
app.use('/api/paymentTransactions', require('./routes/paymentTransaction'));
app.use('/api/dashboard', require('./routes/dashboard'));
if(process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname,'/react-ui/build')));
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, '/react-ui/build','index.html'));
});
}
app.listen(process.env.PORT || 5000, (req, res) => {
console.log(`Started listening on PORT ${process.env.PORT || 5000}`);
});