Servidor HTTP con express que sirve el archivo de rutas
This commit is contained in:
parent
5a5820328c
commit
d94bfa0adc
|
@ -11,6 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"angular": "^1.5.8",
|
"angular": "^1.5.8",
|
||||||
"angular-ui-router": "^1.0.0-beta.3",
|
"angular-ui-router": "^1.0.0-beta.3",
|
||||||
|
"express": "^4.14.0",
|
||||||
"material-design-lite": "^1.2.1",
|
"material-design-lite": "^1.2.1",
|
||||||
"oclazyload": "^0.6.3"
|
"oclazyload": "^0.6.3"
|
||||||
},
|
},
|
||||||
|
|
24
server.js
24
server.js
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
var express = require ('express');
|
||||||
|
|
||||||
|
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 ();
|
||||||
|
app.get ('/routes.json', getRoutes);
|
||||||
|
app.all (/.*/, getDefault);
|
||||||
|
app.listen (8080, onListen);
|
||||||
|
|
Loading…
Reference in New Issue