Created
July 4, 2017 14:08
-
-
Save danielsaad/449898f5f2a54a4469b931c85a21037f to your computer and use it in GitHub Desktop.
Server
This file contains 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
var express = require('express'); | |
var port = process.env.PORT || 8080; | |
var app = express(); | |
var mongoose = require('mongoose'); | |
var Livro = require('./app/models/livroModel'); | |
var bodyParser = require('body-parser'); | |
mongoose.connect('mongodb://127.0.0.1/Livros', function(err) { | |
if (err) throw err; | |
}); | |
app.use(bodyParser.urlencoded({ extended: true })); | |
app.use(bodyParser.json()); | |
var routes = require('./app/routes/routes'); | |
app.use('/',routes); | |
app.listen(port); | |
console.log('Connected on port ' + port); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment