Skip to content

Instantly share code, notes, and snippets.

@pchinjr
Last active February 13, 2018 17:23
Show Gist options
  • Save pchinjr/dbb37c2bba58d3b74c43b9503fc8cee2 to your computer and use it in GitHub Desktop.
Save pchinjr/dbb37c2bba58d3b74c43b9503fc8cee2 to your computer and use it in GitHub Desktop.
expressjs example
const express = require('express');
const app = express();
const server = require("http").createServer(app);
const port = 3000;
server.listen(port);
console.log(`Server listening at http://localhost: ${port}`);
app.use(express.static(__dirname + '/public'));
app.get('/', (req, res) => res.sendFile(__dirname + '/public/index.html'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment