Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path');
- const express = require('express');
- const proxy = require('express-http-proxy');
- const server = express();
- const file = path.join(__dirname, 'dist/index.html');
- const PROTOCOL = 'http';
- const HOST = 'localhost';
- const PORT = 8000;
- server.use(express.static(path.join(__dirname, 'dist')));
- // all request proxy to root ('/')
- //server.use(/\/\w+/, proxy(`${HOST}:${PORT}`));
- server.get('/test', (req, res) => {
- res.sendFile(file);
- });
- server.listen(PORT, HOST, () => console.log(`Sever start on ${PROTOCOL}://${HOST}:${PORT}`));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement