This commit is contained in:
selim mustafaev 2020-06-09 15:33:52 +02:00
parent 22f5327beb
commit 5b1981f78c
3 changed files with 17 additions and 1 deletions

14
package-lock.json generated
View File

@ -449,6 +449,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"
}
},
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
@ -1441,6 +1450,11 @@
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",

View File

@ -11,6 +11,7 @@
"license": "MIT",
"dependencies": {
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-bearer-token": "^2.4.0",
"jsonwebtoken": "^8.5.1",

View File

@ -1,6 +1,7 @@
const express = require('express');
const router = express.Router();
const jwt = require('jsonwebtoken');
const cors = require('cors');
const AvtocodProvider = require('../data_providers/avtocod');
const Vin01Provider = require('../data_providers/vin01');
@ -69,7 +70,7 @@ router.get('/', async (req, res) => {
}
});
router.get('/shared_report', async (req, res) => {
router.get('/shared_report', cors({ origin: 'https://auto.aliencat.pro' }), async (req, res) => {
try {
let { plate_number } = jwt.verify(req.query.token, '#TheTruthIsOutThere');
let collection = req.db.collection('vehicles');