You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
775 B

const path = require('path');
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const host = 'http://localhost';
const port = 3000;
app.use(bodyParser.urlencoded({ extended: false }));
app.use('/static', express.static(path.join(__dirname, 'dist')));
app.use('/assets', express.static(path.join(__dirname, 'assets')));
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'index.html'));
});
app.post('*', (req, res) => {
console.log("to: " + req.path);
console.log(Object.keys(req.body)[0]);
res.end();
});
app.listen(port, 'localhost', (err) => {
if (err) {
console.log(err);
return;
}
console.info('==> Listening on port %s. Open up %s:%s/ in your browser.', port, host, port);
});