-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
49 lines (36 loc) · 1.28 KB
/
Copy pathserver.js
File metadata and controls
49 lines (36 loc) · 1.28 KB
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
var express = require("express"),
app = express(),
cfenv = require("cfenv"),
bodyParser = require('body-parser'),
routes = require('./routes.js'),
Cloudant = require('cloudant');
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
const appEnv = cfenv.getAppEnv();
// serve bower components
app.use('/components', express.static(__dirname + '/bower_components'));
//serve static file (index.html, images, css)
app.use(express.static(__dirname + '/public'));
/*
ROTAS, sim, rotas.
*/
app.get('/api/doLogin', routes.doLogin);
app.get('/api/getAssetByCode/', routes.getAssetbyCode);
app.post('/api/confirmTransaction', routes.confirmTransaction);
app.get('/api/getStep', routes.getStep);
app.get('/api/getCurrent', routes.getCurrent);
app.post('/api/register', routes.register);
// chainMethods
app.post('/api/createChain', routes.createChain);
app.post('/api/passIt', routes.passIt);
app.get('/api/myAssets', routes.myAssets);
app.get('/api/getHistory', routes.getHistory);
/*
Fim rotas
*/
var port = process.env.PORT || 3000
app.listen(port, function() {
console.log("To view your app, open this link in your browser: http://localhost:" + port);
});