-
Notifications
You must be signed in to change notification settings - Fork 0
/
back.js
36 lines (33 loc) · 1.58 KB
/
back.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
const querystring=require('querystring');
var express = require('express');
var app = express();
var jsonfile = require('jsonfile');
// Our handler function is passed a request and response object
app.get('/newfile', function(req, res) {
// We must end the request when we are done handling it
var to = req.query.to,
from = req.query.from;
fileName = req.query.fileName;
description = req.query.description;
amount = req.query.amount;
prevHash = req.query.prevHash;
curHash = req.query.curHash;
jsonfile.writeFile('transactions.json', "to:" + to + "from:" + from +"fileName:" + fileName +"description:" + description +"amount:" + amount +"prevHash:" + prevHash +"curHash:" + curHash )
console.log("to:" + to + "from:" + from +"fileName:" + fileName +"description:" + description +"amount:" + amount +"prevHash:" + prevHash +"curHash:" + curHash );
res.end("OK");
});
app.get('/buyfile', function(req, res) {
// We must end the request when we are done handling it
var to = req.query.to,
from = req.query.from;
fileName = req.query.fileName;
description = req.query.description;
amount = req.query.amount;
prevHash = req.query.prevHash;
curHash = req.query.curHash;
jsonfile.writeFile('transactions.json', "to:" + to + "from:" + from +"fileName:" + fileName +"description:" + description +"amount:" + amount +"prevHash:" + prevHash +"curHash:" + curHash )
console.log("to:" + to + "from:" + from +"fileName:" + fileName +"description:" + description +"amount:" + amount +"prevHash:" + prevHash +"curHash:" + curHash );
res.end("OK");
});
module.exports = app;
app.listen(80);