Last active
January 20, 2023 03:43
-
-
Save danielkwood/291eafdb8d679374d4bcc9ca018278d8 to your computer and use it in GitHub Desktop.
NodeJS & Express course - index.js (example 7 - using res.sendFile() function)
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(); | |
app.get('/', (req, res) => { | |
res.sendFile('index.html', { | |
root: 'public' | |
}); | |
}); | |
app.listen(3000, () => { | |
console.log('Server listening on port 3000'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment