Skip to content

Instantly share code, notes, and snippets.

@jessenaiman
Created October 21, 2014 15:55
Show Gist options
  • Save jessenaiman/91d21af6e621ec233ebb to your computer and use it in GitHub Desktop.
Save jessenaiman/91d21af6e621ec233ebb to your computer and use it in GitHub Desktop.
yeoman angular-fullstack
/**
* Main application file
*/
'use strict';
// Set default node environment to development
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var express = require('express');
var mongoose = require('mongoose');
var config = require('./config/environment');
var Poet = require('poet');
// Connect to database
mongoose.connect(config.mongo.uri, config.mongo.options);
// Populate DB with sample data
if(config.seedDB) { require('./config/seed'); }
// Setup server
var app = express();
var server = require('http').createServer(app);
var socketio = require('socket.io')(server, {
serveClient: (config.env === 'production') ? false : true,
path: '/socket.io-client'
});
require('./config/socketio')(socketio);
require('./config/express')(app);
require('./routes')(app);
var poet = Poet(app);
poet.init().then(function () {
console.error('poet is called'.green);
app.use(function(err, req, res, next){
console.error(err.stack);
res.status(500).send('Poet sort of works!'.red);
});
});
// Start server
server.listen(config.port, config.ip, function () {
console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
});
// Expose app
exports = module.exports = app;
@jessenaiman
Copy link
Author

Even if this works, how can I find the available routes, or even list them on a page?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment