-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
26 lines (19 loc) · 815 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
const http = require("http")
const PaymentInformationController = require("./Controllers/PaymentInformationController");
const server = http.createServer((req, res) => {
let paymentInformationController = new PaymentInformationController();
if (req.method === 'POST' && req.url === "/api/validate-card"){
paymentInformationController.handle(req, res);
return;
}
if (req.method === 'POST' && req.url === "/api/get-hash"){
paymentInformationController.getHash(req, res);
return;
}
paymentInformationController.handleResponse(res, 404, {
status: "Not Found",
message: "The requested resource was not found on this server"
});
})
const PORT = process.env.PORT || 5000
server.listen(PORT, () => console.log(`server running on port ${PORT}`))