-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackend.js
39 lines (31 loc) · 1.16 KB
/
backend.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
var express = require('express');
var app = express();
var cors = require("cors");
app.use(cors());
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.get('/application/constraints', function (req, res) {
res.header('Cache-Control', 'no-cache');
res.json({
amountInterval: {min: 10, max: 2000, step: 10, defaultValue: 400}, // IntervalBean:BigDecimal Scrollable Amount interval
monthlyPaymentInterval: {min: 10, max: 2000, step: 10, defaultValue: 400}, // IntervalBean:BigDecimal Scrollable monthly payment interval
termInterval: {min: 3, max: 30, step: 1, defaultValue: 15}, // IntervalBean:Integer Scrollable term interval
});
})
app.get('/application/first-loan-offer', function (req, res) {
var amount = req.query.amount;
var term = req.query.term;
res.json({
totalPrincipal: amount,
term: term,
totalCostOfCredit: amount / 10,
totalRepayableAmount: amount * 1.2,
monthlyPayment: amount / term
})
})
var server = app.listen(8001, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});