Skip to content

Instantly share code, notes, and snippets.

@hitalos
Created November 27, 2017 04:31
Show Gist options
  • Save hitalos/4a0ec7138220faa924d0a4d941c0837c to your computer and use it in GitHub Desktop.
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
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