-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
47 lines (35 loc) · 884 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var express = require('express'),
app = express(),
arcgis = require("./lib/arcgis"),
config = require("./application-config.json");
//Set views directory
app.set('views', __dirname + '/views');
app.use(express.bodyParser());
/**
* Main application Route.
*/
app.get("/", function(req, res) {
res.render("index.jade");
});
/**
* Get app config
*/
app.get("/config", function(req, res) {
res.json(config.client);
});
app.get("/route/*", function(req, res, next) {
arcgis.route(req.query, res);
});
/**
* get a token to use routing
*/
app.post("/route/*", function(req, res, next) {
arcgis.route(req.body, res);
});
app.get("/servicearea/*", function(req, res, next) {
arcgis.serviceArea(req.query, res);
});
//setup static route
app.use('/assets', express.static(__dirname + '/assets'));
app.listen(process.env.PORT || 1337);
console.log("Runnur is running!");