Skip to content

Instantly share code, notes, and snippets.

@jubalm
Created July 20, 2016 10:06
Show Gist options
  • Save jubalm/82bb7a76a82e7c1effa906a372160887 to your computer and use it in GitHub Desktop.
Save jubalm/82bb7a76a82e7c1effa906a372160887 to your computer and use it in GitHub Desktop.
Simple express server
const path = require('path');
const express = require('express');
const port = process.env.PORT || 3000;
const server = express();
server.get('/favicon.ico', function(req, res) {
res.writeHead(200, { 'Content-Type': 'image/x-icon' });
res.end();
});
server.use(express.static(path.resolve(__dirname, 'public')));
server.listen(port, (err) => {
if (err) {
console.error(err);
}
console.info(`🌎 Listening on port ${port}. Open up http://localhost:${port}/ in your browser.`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment