Skip to content

Instantly share code, notes, and snippets.

@samg11
Created February 22, 2021 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samg11/56a74a49ee5768db8976216a1ce5d404 to your computer and use it in GitHub Desktop.
Save samg11/56a74a49ee5768db8976216a1ce5d404 to your computer and use it in GitHub Desktop.
Express app with react
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