2016-10-06 10:16:07 +00:00
|
|
|
|
|
|
|
var express = require ('express');
|
2016-10-06 13:32:03 +00:00
|
|
|
var cors = require ('cors');
|
2016-10-06 10:16:07 +00:00
|
|
|
|
|
|
|
function getRoutes (req, res)
|
|
|
|
{
|
|
|
|
var routes = require ('./build/salix.routes.json');
|
|
|
|
res.send (JSON.stringify (routes));
|
|
|
|
}
|
|
|
|
|
|
|
|
function getDefault (res, res)
|
|
|
|
{
|
|
|
|
res.sendStatus (404);
|
|
|
|
}
|
|
|
|
|
|
|
|
function onListen ()
|
|
|
|
{
|
|
|
|
console.log ('HTTP server started.');
|
|
|
|
}
|
|
|
|
|
|
|
|
var app = express ();
|
2016-10-06 13:32:03 +00:00
|
|
|
app.get ('/routes', cors (), getRoutes);
|
|
|
|
app.all (/.*/, cors (), getDefault);
|
2016-10-06 10:16:07 +00:00
|
|
|
app.listen (8080, onListen);
|
|
|
|
|