diff --git a/API.js b/API.js new file mode 100644 index 0000000..3e234a8 --- /dev/null +++ b/API.js @@ -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; \ No newline at end of file diff --git a/server.js b/server.js index 5693536..94cff74 100644 --- a/server.js +++ b/server.js @@ -1,29 +1,25 @@ //Dependencies var express = require('express'); var app = express(); -//var Promise = require('promise'); -//var morgan = require('morgan'); +var Promise = require('promise'); +var API = require(__dirname + '/API.js'); //OpenShift Settings 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; -//Reporting -//app.use(morgan('combined')); - -//External Routing +//External Routing Of Public Assets app.use('/public', express.static(__dirname + '/public')); +//External Routing Of API +app.use('/api', API); + +//External Other Routes app.get('*', function (req, res) { console.log('works as expected'); res.sendFile(__dirname + '/public/views/pages/index.html'); - //res.send('Hello World Again!'); }); //app Initialize app.listen(port, ip); -//console.log('live on ip: ' + ip + ':' + port); -console.log('Server running on http://%s:%s', ip, port); -//console.log(JSON.stringify(process.env)); - -//module.exports = webapp; \ No newline at end of file +console.log('Server running on http://%s:%s', ip, port); \ No newline at end of file