-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·49 lines (44 loc) · 1.4 KB
/
index.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
38
39
40
41
42
43
44
45
46
47
48
49
const express = require("express");
const app = express();
const handlebars = require("express-handlebars");
const compiler = require('ember-template-compiler');
const path = require ("path");
const route = require("./routes/route");
app.use(express.static('public/img'));
app.use(route);
//config template engine
//handlebars
app.engine('handlebars', handlebars({defaultLayout: 'main'}))
app.set('view engine', 'handlebars')
app.engine('handlebars', handlebars({
helpers:{
buttonDate: function(documentValid){
if(documentValid == '1'|| documentValid == 1){
let result = '</form><button class="btn btn-success">Aceito</button>'
return new compiler.EmberHandlebars.SafeString(result);
}
else if(documentValid == '0'|| documentValid == 0){
let result = '<button class="btn btn-danger">Deletar</button>'
return new compiler.EmberHandlebars.SafeString(result);
}
else{
let result = '</form><button class="btn btn-warning">Aguardando </button>'
return new compiler.EmberHandlebars.SafeString(result);
}
}
}
}))
//static
app.use(express.static(path.join(__dirname, 'static')))
//route app
app.get('/', (req, res) => {
res.render('home/log')
//atualizar para página de login
})
app.get('./home/show', (req, res) =>{
res.render("./home/show")
})
const PORT = 6660
app.listen(PORT, () => {
console.log("Servidor rodando na url http://localhost:6660")
})