Created
March 24, 2019 00:25
-
-
Save lamecksilva/77e0d44cc70ba927f6a3023aa7831b59 to your computer and use it in GitHub Desktop.
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
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const mongoose = require('mongoose'); | |
const app = express(); | |
app.use(bodyParser.json()); | |
// Adicionando arquivo de rota no endpoint /carros | |
const carros = require('./routes/carros'); | |
app.use('/api/carros', carros); | |
mongoose | |
.connect('mongodb://db:27017/crud-node-mongo-docker', { | |
useNewUrlParser: true | |
}) | |
.then(result => { | |
console.log('MongoDB Conectado'); | |
}) | |
.catch(error => { | |
console.log(error); | |
}); | |
app.listen(9000, () => console.log('Server ativo na porta 9000')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment