-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (29 loc) · 942 Bytes
/
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
31
32
33
34
35
36
require('dotenv').config();
const path = require('path');
const express = require('express');
const cors = require('cors')
const { dbConnection } = require('./database/config');
// Create server express
const app = express();
// Config CORS
app.use(cors());
// Read and Parse body
app.use(express.json());
// Data Base
dbConnection();
// Public Folder
app.use(express.static('public'));
// Routes
app.use('/api/users', require('./routes/users'));
app.use('/api/hospitals', require('./routes/hospitals'));
app.use('/api/doctors', require('./routes/doctors'));
app.use('/api/all', require('./routes/searches'));
app.use('/api/uploads', require('./routes/uploads'));
app.use('/api/login', require('./routes/auth'));
// Routes Admin
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'public/index.html'));
});
app.listen( process.env.PORT || 3000, () => {
console.log('Server Listen in port: ' + process.env.PORT);
} );