Last active
October 4, 2018 05:48
-
-
Save ganeshkbhat/8f2bfc4a405dc31ace963e8b58adc906 to your computer and use it in GitHub Desktop.
ExpressJS Series: Serving static ffile
This file contains 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 path = require('path'); | |
/* ALL OTHER CODE */ | |
// Serves index.html from the public folder when ... | |
// ... the client requests http://127.0.0.1:9001/ | |
app.get("/", function(req, res) { | |
res.status(200) | |
.sendFile(path.join(__dirname, 'public', 'index.html')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment