Update Arch
This commit is contained in:
parent
1c6b19178e
commit
38ae7d2ed7
2 changed files with 17 additions and 12 deletions
9
API.js
Normal file
9
API.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
var express = require('express');
|
||||||
|
var router_API = express.Router([options]);
|
||||||
|
var options;
|
||||||
|
|
||||||
|
router_API.get('/route1', function(req, res) {
|
||||||
|
res.send('This worked');
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router_API;
|
20
server.js
20
server.js
|
@ -1,29 +1,25 @@
|
||||||
//Dependencies
|
//Dependencies
|
||||||
var express = require('express');
|
var express = require('express');
|
||||||
var app = express();
|
var app = express();
|
||||||
//var Promise = require('promise');
|
var Promise = require('promise');
|
||||||
//var morgan = require('morgan');
|
var API = require(__dirname + '/API.js');
|
||||||
|
|
||||||
//OpenShift Settings
|
//OpenShift Settings
|
||||||
var ip = process.env.IP || process.env.OPENSHIFT_NODEJS_IP || '0.0.0.0';
|
var ip = process.env.IP || process.env.OPENSHIFT_NODEJS_IP || '0.0.0.0';
|
||||||
var port = process.env.PORT || process.env.OPENSHIFT_NODEJS_PORT || 8080;
|
var port = process.env.PORT || process.env.OPENSHIFT_NODEJS_PORT || 8080;
|
||||||
|
|
||||||
//Reporting
|
//External Routing Of Public Assets
|
||||||
//app.use(morgan('combined'));
|
|
||||||
|
|
||||||
//External Routing
|
|
||||||
app.use('/public', express.static(__dirname + '/public'));
|
app.use('/public', express.static(__dirname + '/public'));
|
||||||
|
|
||||||
|
//External Routing Of API
|
||||||
|
app.use('/api', API);
|
||||||
|
|
||||||
|
//External Other Routes
|
||||||
app.get('*', function (req, res) {
|
app.get('*', function (req, res) {
|
||||||
console.log('works as expected');
|
console.log('works as expected');
|
||||||
res.sendFile(__dirname + '/public/views/pages/index.html');
|
res.sendFile(__dirname + '/public/views/pages/index.html');
|
||||||
//res.send('Hello World Again!');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//app Initialize
|
//app Initialize
|
||||||
app.listen(port, ip);
|
app.listen(port, ip);
|
||||||
//console.log('live on ip: ' + ip + ':' + port);
|
console.log('Server running on http://%s:%s', ip, port);
|
||||||
console.log('Server running on http://%s:%s', ip, port);
|
|
||||||
//console.log(JSON.stringify(process.env));
|
|
||||||
|
|
||||||
//module.exports = webapp;
|
|
Loading…
Add table
Add a link
Reference in a new issue