Skip to content

Instantly share code, notes, and snippets.

@sivadass
Created November 16, 2017 02:59
Show Gist options
  • Save sivadass/f762dbec0a84a9bf6cd4d92e4043515b to your computer and use it in GitHub Desktop.
Save sivadass/f762dbec0a84a9bf6cd4d92e4043515b to your computer and use it in GitHub Desktop.
Express HTTP Server
const path = require('path');
const express = require('express');
const app = express();
// DEFINES A FOLDER FOR THE STATIC FILES
app.use(express.static('public'));
// DEFINES THE MAIN ENTRY POINT
app.get('/', (req, res) =>{
res.sendFile(path.resolve(__dirname, 'public', 'index.html'));
});
app.listen(3000, () =>{
console.log('App web-server listening on port 3000');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment