Last active
November 16, 2018 20:09
-
-
Save tuliofaria/5b15d8fdd6f32d16bb1814062732cbb3 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 path = require('path') | |
const app = express() | |
const port = process.env.PORT || 3000 | |
const mysql = require('mysql') | |
const connection = mysql.createConnection({ | |
host:'127.0.0.1', | |
port:'8889', | |
user:'root', | |
password:'root', | |
database:'cadastro' | |
}) | |
const dependencies = { | |
connection | |
} | |
const pessoas = require('./routes/pessoas') | |
app.use(express.static('public')) | |
app.get('/',(req,res) => res.render('home')) | |
app.use('/pessoas',pessoas(dependencies)) | |
//Diretório em que será guardado os view engines | |
app.set('views',path.join(__dirname,'views')) | |
app.set('view engine','ejs') | |
connection.connect((err) => { | |
console.log(err) | |
app.listen(port, () => console.log('CRUD listening on port: '+port)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment