Browse Source

add cors

master
Gisle Aune 2 years ago
parent
commit
a57a558dc5
  1. 9
      package-lock.json
  2. 1
      package.json
  3. 3
      src/server.js

9
package-lock.json

@ -344,6 +344,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",

1
package.json

@ -10,6 +10,7 @@
"author": "Gisle",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.1",
"express-ws": "^4.0.0",
"iconsole-bike-client": "^0.1.3",

3
src/server.js

@ -1,5 +1,6 @@
const express = require("express");
const expressWs = require("express-ws");
const cors = require('cors');
const SQLite3Repository = require("./repositories/sqlite3");
@ -15,6 +16,8 @@ repo.setup().catch(err => {
const app = express();
expressWs(app);
app.use(cors());
app.use(express.json({strict: false}));
app.use("/api/bike/", require("./api/bike")(repo));

Loading…
Cancel
Save