littlelink-server/src/index.js
Techno Tim 84b1a800c7
feat(rewrite): Rewrote the whole thing in ReactJS 💅 (#22)
* feat(rewrite): Rewrote the whole thing in ReactJS 💅

* chore(docs): Updated
2021-08-25 19:16:09 -05:00

29 lines
627 B
JavaScript

/* eslint-disable no-console */
import express from 'express';
let app = require('./server').default;
if (module.hot) {
module.hot.accept('./server', () => {
console.log('🔁 HMR Reloading `./server`...');
try {
app = require('./server').default;
} catch (error) {
console.error(error);
}
});
console.info('✅ Server-side HMR Enabled!');
}
const port = process.env.PORT || 3000;
export default express()
.use((req, res) => app.handle(req, res))
.listen(port, err => {
if (err) {
console.error(err);
return;
}
console.log(`> Started on port ${port}`);
});