Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// include dependencies
import express from 'express';
import bodyParser from 'body-parser';
import fallback from 'express-history-api-fallback';
import path from 'path';
import Sign from './sign';
const app = express();
const sign = new Sign();
app.post('/sign', (req, res, next) => {
console.log(req.body);
if (sign.writeMessage(req.body.message, req.body.mode)) {
res.json('success');
} else {
res.status(500).send();
}
});
app.use('/', express.static(cwd));
app.use(fallback(path.join(cwd, 'index.html')));
app.listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.