mirror of
https://github.com/techno-tim/littlelink-server.git
synced 2024-11-23 05:35:28 +01:00
29 lines
627 B
JavaScript
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}`);
|
||
|
});
|