Skip to content

Instantly share code, notes, and snippets.

@yeti-detective
Created March 3, 2017 20:44
Show Gist options
  • Save yeti-detective/1c5c7646cfa88a39434b85d642d56ea1 to your computer and use it in GitHub Desktop.
Save yeti-detective/1c5c7646cfa88a39434b85d642d56ea1 to your computer and use it in GitHub Desktop.
const express = require('express'); // this is just so easy. Read up on it later
const app = express(); // now 'app' is an express application
const path = require('path'); // this will help you tell Node where your files are
// when the app 'gets' a request, it will send the index.html file
app.get('/', (req, res)=>{
res.sendFile(path.join(__dirname + '/index.html'));
});
// the app will listen for requests on port 3000
app.listen(3000, ()=>{
console.log('listening on http://localhost:3000');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment