-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (23 loc) · 850 Bytes
/
app.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
// app.js
import express from 'express';
import bloodSearchRequestRoutes from './Routes/bloodSearchRoute.js';
import { checkBloodRequestsProximity } from './Services/geolocationService.js';
import { fileURLToPath } from 'url';
import path from 'path';
import bodyParser from 'body-parser';
import cors from 'cors';
const app = express();
const PORT = process.env.PORT || 8082;
const __filename = fileURLToPath(import.meta.url);
// Get the directory name
const __dirname = path.dirname(__filename);
app.use(bodyParser.json());
app.use(cors());
app.use('/api', bloodSearchRequestRoutes);
// setInterval(async () => {
// const bloodBankCoordinates = [40.123, 32.456];
// await checkBloodRequestsProximity(bloodBankCoordinates);
// }, 10000);
app.listen(PORT, () => {
console.log(`Staff Service is listening at http://localhost:${PORT}`);
});