Created
November 27, 2017 04:31
-
-
Save hitalos/4a0ec7138220faa924d0a4d941c0837c to your computer and use it in GitHub Desktop.
Exemplo de aplicação web usando templates carregados na memória e arquivos estáticos
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 express = require('express') | |
const pug = require('pug') | |
const app = express() | |
const index = pug.compileFile('views/index.pug') | |
app.get('/', (req, res) => { | |
res.send(index({ title: 'Express' })) | |
}) | |
app.use(express.static('public')) | |
app.listen(8000, () => { | |
console.log('Express listening at: http://Hitmac.local:8000') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment