diff options
Diffstat (limited to 'ws/ws.js')
| -rw-r--r-- | ws/ws.js | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -9,7 +9,6 @@ class WebSocket { this.client = client; this.app = express(); - this.app.use(allowCrossDomain); this.app.engine('hbs', hbs({ extname: 'hbs', defaultLayout: 'layout', @@ -45,6 +44,12 @@ class WebSocket { // http://localhost:port?token=123456 registerRoots() { + this.app.all('*', function (req, res, next) { + res.header('Access-Control-Allow-Origin', '*'); + res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS'); + res.header('Access-Control-Allow-Headers', 'Content-Type'); + next(); + }); this.app.get('/', (req, res) => { var _token = req.query.token; if (this.checkToken(_token)) { |