test_react_hook/server.js

14 lines
371 B
JavaScript
Raw Normal View History

2020-05-07 09:55:01 +07:00
const path = require('path');
const express = require('express');
const app = express();
2020-05-07 12:13:18 +07:00
const publicPath = path.join(__dirname, '.', 'public');
2020-05-07 09:55:01 +07:00
const port = process.env.PORT || 3000;
app.use(express.static(publicPath));
app.get('*', (req, res) => {
res.sendFile(path.join(publicPath, 'index.html'));
});
app.listen(port, () => {
console.log('Server is up!');
});