JSFiddle - React, Tailwind, and code Playground
HTML
Folder Structure
- dist
- app
- bootstrap.js
- app.component.js
- server
- index.js
- index.html
- node_modules
- jspm_packages
- src
- app
- bootstrap.ts
- app.component.ts
- server
- index.ts
- index.jade
- typings
JavaScript
const app = express();
app.use('/jspm_packages', express.static('jspm_packages'));
app.use('/node_modules', express.static('node_modules'));
// app.use('/dist', express.static('dist'));
app.get('*', function(req, res) {
console.log('got called');
const file = fs.readFileSync('dist/index.html').toString();
return res.send(file);
});
app.listen(process.env.PORT || 3000);