-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
41 lines (32 loc) · 1.28 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
import express from "express";
import { transferAmount } from "./models/index.js";
import { getWorkingRecordByEmail } from "./services/workingRecordService.js";
import { getIndividualInformationByEmail } from "./services/individualInformationService.js";
const app = express();
const port = 3000;
app.get("/", (req, res) => {
return res.status(200).send("Hello World!");
});
app.get("/individual-information/:email", (req, res) => {
const email = req.params.email;
const result = getIndividualInformationByEmail(email);
if (result == undefined)
return res.status(404).json('Individual Information not found');
return res.status(200).json(result);
});
app.get("/working-records/:email", async(req, res) => {
const email = req.params.email;
const result = await getWorkingRecordByEmail(email);
if (result == undefined)
return res.status(404).json('Working Record not found');
return res.status(200).json(result);
});
app.get("/monthly-payment/:email", (req, res) => {
const email = req.params.email;
let monthlyPayment = transferAmount(email);
return res.json(monthlyPayment);
});
const server = app.listen(process.env.PORT || 3000, () => {
return console.log(`Example app listening at http://localhost:${port}`);
});
export { app, server }