-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.js
27 lines (20 loc) · 860 Bytes
/
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
// external
const express = require("express");
const bodyParser = require('body-parser');
const config = require('./config');
// controllers
const DummyTokensController = require('./controllers/dummy-tokens');
const app = express();
// middleware
app.use(bodyParser.json());
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
// routes
// Get a dummy token's balance for a given address.
app.get('/dummy-tokens/:tokenAddress/balance/:address', DummyTokensController.getTokenBalance);
// Set a dummy token's balance.
app.post('/dummy-tokens/:tokenAddress/balance/:address', DummyTokensController.setTokenBalance);
app.listen(config.port, () => console.log('Running on http://localhost:' + config.port));