Last active
May 2, 2017 09:19
-
-
Save gorkamu/ae0f67b70addbe4ee716d81927d47ac0 to your computer and use it in GitHub Desktop.
Example of node js entrypoint with mongoose configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '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