Skip to content

Instantly share code, notes, and snippets.

@gorkamu
Last active May 2, 2017 09:19
Show Gist options
  • Select an option

  • Save gorkamu/ae0f67b70addbe4ee716d81927d47ac0 to your computer and use it in GitHub Desktop.

Select an option

Save gorkamu/ae0f67b70addbe4ee716d81927d47ac0 to your computer and use it in GitHub Desktop.
Example of node js entrypoint with mongoose configuration
'use strict'
var mongoose = require('mongoose');
var app = require('./app');
var port = process.env.PORT || 3000;
// Puerto por defecto de mongodb
mongoose.connect('mongodb://localhost:27017/base-de-datos-de-prueba', function(err, res){
if(err){
throw err;
}else{
app.listen(port, () => {
console.log(`Server running in http://localhost:${port}`);
console.log('Defined routes:');
console.log(' [GET] http://localhost:3000/prueba/:nombre');
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment