-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
69 lines (54 loc) · 1.53 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
Title: SiteStatus-API
Description: A RESTFul API to monitor up or down time of user defined links
Author: Anik Adhikari
Date: 11/10/2023
*/
// dependencies
const server = require("./lib/server");
const worker = require("./lib/worker");
// app object - module scaffolding
const app = {};
app.init = () => {
// start the server
server.init();
// start the workers
worker.init();
};
app.init();
// export the app
module.exports = app;
// -----------------------------------------------------------------------------------------
// intial code
/*
Title: SiteStatus-API
Description: A RESTFul API to monitor up or down time of user defined links
Author: Anik Adhikari
Date: 11/10/2023
// dependencies
const http = require("http");
const { handleReqRes } = require("./helpers/handleReqRes");
const environment = require("./helpers/environments");
const data = require("./lib/data");
// const { sendTwilioSms } = require("./helpers/notifications");
// app object - module scaffolding
const app = {};
// // TODO delete later
// sendTwilioSms("9749946845", "ayoh anik", (err) => {
// console.log(`This is the error:`, err);
// });
// data.delete('test', 'newFile', (err) => {
// console.log('Error:', err);
// });
// create server
app.createServer = () => {
const server = http.createServer(app.handleReqRes);
server.listen(environment.port, () => {
console.log(`listening to port ${environment.port}`);
});
};
// handle request response
app.handleReqRes = handleReqRes;
// start the server
app.createServer();
*/