forked from Chloe22204/pawpingphils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
37 lines (30 loc) · 851 Bytes
/
server.js
File metadata and controls
37 lines (30 loc) · 851 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
29
30
31
32
33
34
35
36
37
require('dotenv').config();
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const emergencyRoute = require('./src/routes/emergencyRoute');
const port = process.env.PORT || 3000;
const app = express();
// Middleware
app.use(cors());
app.use(bodyParser.json());
app.use(express.urlencoded({ extended: true }));
// Logging
app.use((req, res, next) => {
console.log(`[${new Date().toISOString()}] ${req.method} ${req.path}`);
next();
});
// Routes
app.use('/api/v1/emergency', emergencyRoute);
// Root check
app.get('/', (req, res) => {
res.json({
status: 'Online',
service: 'Senior Emergency Triage Backend',
endPoints: ['/api/v1/emergency/triage']
});
});
// Start Server
app.listen(port, () => {
console.log(`Server running on http://localhost:${port}`);
});