Skip to content

Instantly share code, notes, and snippets.

@Ranner198
Created February 26, 2019 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ranner198/5ed23f7edbec0337c07a614e811fa3f4 to your computer and use it in GitHub Desktop.
Save Ranner198/5ed23f7edbec0337c07a614e811fa3f4 to your computer and use it in GitHub Desktop.
const express = require('express');
const app = express();
const path = require('path');
const port = 8080;
//Tell us when the server is up and running + where at
console.log("I am running at: " + port);
//Start the listener
app.listen(port);
//Home Page
app.get('/home/', function(req, res) {
res.sendFile(path.join(__dirname + '/example.html'));
});
//On Error
app.use(function (req, res, next) {
res.status(404).sendFile(path.join(__dirname + 'filename.html'))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment