Created
August 1, 2017 23:32
-
-
Save firminochangani/e35b3b523064fc15f023bab57f75591c to your computer and use it in GitHub Desktop.
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
// Dependências | |
const express = require('express'); | |
const models = require('./models.js'); | |
const routes = require('./routes.js'); | |
// Iniciar o express | |
const app = express(); | |
// Iniciar a BD | |
models.openDB(); | |
// Rotas | |
routes(app); | |
app.listen(3000, function(){ | |
console.log('Server no ar'); | |
}); |
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
module.exports = function(req, res){ | |
res.json({ | |
message: "Okapa" | |
}); | |
} |
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
module.exports = function(req, res){ | |
res.json({ | |
message: "Okapa" | |
}); | |
} |
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
module.exports.openDB = function(){ | |
// Código da conexão com a base de dados | |
} |
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
const ctrlX = require('./controllerX.js'); | |
const ctrlY = require('./controllerY.js'); | |
module.exports = function(app){ | |
app.get('/x', ctrlX); | |
app.get('/x', ctrlY); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment