-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
37 lines (26 loc) · 768 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// módulos
const express = require('express');
const handlebars = require('express-handlebars');
const bodyParser = require('body-parser');
const app = express();
const userRoutes = require("./routes/users");
const path = require('path');
//config
//config database
// public
app.use(express.static(path.join(__dirname, "public")));
// body parser
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
//handlebars
app.engine('handlebars', handlebars({defaultLayout: 'main'}));
app.set('view engine','handlebars');
//rotas
app.use('/', userRoutes);
//outros
const servidor = "localhost";
const database = "database";
const port = 3000;
app.listen( port, () =>{
console.log("Servidor iniciado com sucesso! " + "porta " + port);
});