Skip to content

Commit

Permalink
fix: allow CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
namhoang1604 committed Jun 17, 2024
1 parent 2f4656e commit 44dbdee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions resolver_web_server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"author": "Nick Lansley and Rajesh Kumar Rana for GS1 AISBL",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.1",
"http-status-codes": "^1.4.0",
"mongodb": "^3.5.8",
Expand Down
15 changes: 12 additions & 3 deletions resolver_web_server/src/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const express = require('express');
const cors = require('cors');

const app = express();

Expand All @@ -18,18 +19,24 @@ const utilDbController = require('./db/query-controller/utilDbController');

const PORT = process.env.PORT || 8080;

app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(express.static('public'));

// Setup the routes for API or requested endpoint(s)
app.use('/resolverdescriptionfile.schema.json', resolverDescFileRouter);
app.use('/.well-known/resolverdescriptionfile.schema.json', resolverDescFileRouter);
app.use(
'/.well-known/resolverdescriptionfile.schema.json',
resolverDescFileRouter
);
app.use('/hello', heartBeatRouter);
app.use('/.well-known', wellKnownRouter);
app.use('/unixtime', unixTimeRouter);
app.use('/dashboard', dashboardController);
app.use('/health/live', (req, res) => {res.status(200).send('OK');});
app.use('/health/live', (req, res) => {
res.status(200).send('OK');
});
app.use('/health/ready', utilDbController);
app.use('/', analyseURI, aiRouterApp);

Expand All @@ -48,7 +55,9 @@ app.listen(PORT, (err) => {
console.log('Server listen error:', err);
return;
}
console.log(`GS1 DigitalLink ID Server is listening on port ${PORT} in this container`);
console.log(
`GS1 DigitalLink ID Server is listening on port ${PORT} in this container`
);
});

/**
Expand Down

0 comments on commit 44dbdee

Please sign in to comment.