Created
February 22, 2021 23:30
-
-
Save samg11/56a74a49ee5768db8976216a1ce5d404 to your computer and use it in GitHub Desktop.
Express app with react
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 PORT = process.env.PORT || 8080; | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'jsx'); | |
app.engine('jsx', require('express-react-views').createEngine()); | |
app.get('/', (req, res) => { | |
res.render('index', { | |
name: 'Sam' | |
}); | |
}); | |
app.listen(PORT, () => { | |
console.log(`Server is listening on port ${PORT}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment