Last active
November 12, 2017 19:52
-
-
Save robertcoopercode/9c3d256b9894fa967fb33ca2f9a35717 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
// Route that serves index.html | |
router.get('/', (request, response) => { | |
response.setHeader('Content-Type', 'text/html'); | |
// Capture the contents of index.html in a variable | |
let fileContents = fs.readFileSync("./public/index.html", {encoding: "utf8"}); | |
// Send a response to the client with the index.html file | |
response.write(fileContents); | |
response.end(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment