add CORS headers to API responses
This commit is contained in:
parent
a8f9074f48
commit
4a2caf9bae
3
index.js
3
index.js
|
|
@ -3,6 +3,7 @@
|
|||
var fs = require('fs');
|
||||
var sqlite3 = require('./sqlite3-promises');
|
||||
var express = require('express');
|
||||
var cors = require('cors');
|
||||
|
||||
const POLLING_TIMEOUT = 60000/*ms*/;
|
||||
|
||||
|
|
@ -428,6 +429,8 @@ async function postGameHandler(req, res, next) {
|
|||
|
||||
const app = express();
|
||||
|
||||
app.use(cors());
|
||||
|
||||
app.get('/pacosako/api/games/poll/:afterTime', catchExceptionsJson(getGameListHandler));
|
||||
app.get('/pacosako/api/games', catchExceptionsJson(getGameListHandler));
|
||||
|
||||
|
|
|
|||
|
|
@ -210,6 +210,15 @@
|
|||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||
},
|
||||
"cors": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"requires": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
}
|
||||
},
|
||||
"dashdash": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
"description": "",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"sqlite3": "^4.1.1"
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue