Created
February 26, 2019 20:49
-
-
Save Ranner198/5ed23f7edbec0337c07a614e811fa3f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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