Skip to content

Instantly share code, notes, and snippets.

@flowck
Created August 1, 2017 23:32
Show Gist options
  • Save flowck/e35b3b523064fc15f023bab57f75591c to your computer and use it in GitHub Desktop.
Save flowck/e35b3b523064fc15f023bab57f75591c to your computer and use it in GitHub Desktop.
// 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');
});
module.exports = function(req, res){
res.json({
message: "Okapa"
});
}
module.exports = function(req, res){
res.json({
message: "Okapa"
});
}
module.exports.openDB = function(){
// Código da conexão com a base de dados
}
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