Skip to content

Instantly share code, notes, and snippets.

@SergioDiniz
Created July 21, 2017 17:06
Show Gist options
  • Save SergioDiniz/e66bb4757aea0c5abd105f546e6d2785 to your computer and use it in GitHub Desktop.
Save SergioDiniz/e66bb4757aea0c5abd105f546e6d2785 to your computer and use it in GitHub Desktop.
servidor estático nodejs
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