Created
March 28, 2020 04:58
-
-
Save dot1q/2f677d648f01dcacfa2e29f36a0e0982 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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