-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
43 lines (36 loc) · 907 Bytes
/
server.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
37
38
39
40
41
42
43
/*
Comments:
* Title: Uptime Monitoring App
* Description: Server uptime monitoring app with Restful Api.
* Author: Parvez Hasan Rubel
* Date: 08/10/2024
* 1.0.0: 2022.10.20
*/
// dependencies
const http = require('http');
const { handleReqRes } = require('./helpers/handleReqRes');
const environments = require('./helpers/environments');
const data = require('./lib/data');
// app object module scaffolding
const app = {};
// data.createData(
// 'test',
// 'text',
// {
// name: 'Parvez',
// job: 'Developer',
// },
// (err) => {
// console.log(err);
// }
// );
// create server
app.createServer = () => {
const server = http.createServer(app.handleRequest);
server.listen(environments.port);
console.log(`Server listening on port ${environments.port}...`);
};
// handle request
app.handleRequest = handleReqRes;
// start server
app.createServer();