Created
July 21, 2017 17:06
-
-
Save SergioDiniz/e66bb4757aea0c5abd105f546e6d2785 to your computer and use it in GitHub Desktop.
servidor estático nodejs
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 PORT = 8080 | |
const http = require('http'); | |
const finalhandler = require('finalhandler'); | |
const serveStatic = require('serve-static'); | |
const serve = serveStatic("./app/"); | |
const server = http.createServer((req, res) => { | |
const done = finalhandler(req, res); | |
serve(req, res, done); | |
}); | |
server.listen(PORT, () => { | |
console.log('servidor rodando na porta: ' + PORT) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment