-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create kennisbank-api server #912
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
4283914
to
62f2cbf
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅ |
3bb8a9c
to
eed2de4
Compare
eed2de4
to
8ee49b2
Compare
8ee49b2
to
fee9af1
Compare
fee9af1
to
9e528a7
Compare
9e528a7
to
e996af8
Compare
e996af8
to
fa92053
Compare
0fa2dc6
to
905f23d
Compare
apps/overige-object-api/README.md
Outdated
After generating the token, include it in your request headers as a Bearer token. Here's an example: | ||
|
||
```ts | ||
Authorization: Bearer API_TOKEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authorization: Bearer API_TOKEN | |
Authorization: Token API_TOKEN |
apps/overige-object-api/README.md
Outdated
|
||
```shell | ||
OVERIGE_OBJECT_API_PORT=4001 | ||
OVERIGE_OBJECT_API_CORS=http://localhost:3000 # If using multiple domains, separate them with a comma (e.g., 'http://localhost:3000, http://localhost:3001'). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De # comment
aan het eind van de regel, die kan gewoon voor het code block in de lopende tekst.
apps/overige-object-api/README.md
Outdated
To start the service, open a terminal in the project root and run: | ||
|
||
```shell | ||
cd bin && bash ./deploy.sh pdc-dashboard prod up --build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Op deze manier hoef je niet achteraf cd ..
te doen, en kun je het command meerdere keren achter elkaar draaien zonder extra commands.
cd bin && bash ./deploy.sh pdc-dashboard prod up --build | |
( cd bin && bash ./deploy.sh pdc-dashboard prod up --build ) |
apps/overige-object-api/package.json
Outdated
"url": "[email protected]:frameless/strapi.git", | ||
"directory": "apps/overige-object-api" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In de toekomst is het misschien leuk om twee versies te hebben van de Overige Objecten API:
- Strapi als bron. Optioneel, bijvoorbeeld met
npm run start --strapi https://strapi.localhost:1337/"
- Filesystem als bron. Bijvoorbeeld
npm run start --object-dir objects/ --object-types-dir object-types/
Utility functions om dit te maken zouden ook handig zijn voor tests. Bijvoorbeeld:
let server;
beforeEach(() => {
server = serverFromFileSystem({
objectDir: 'fixtures/scenario-5/objects',
objectDir: 'fixtures/scenario-5/objects-types',
});
});
doelgroep: 'eu-burger', | ||
}, | ||
], | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ik zou het netter vinden om de const data
buiten de functie te plaatsen.
*/ | ||
const handleGraphqlError = (error: any) => { | ||
const errorMessage = error?.message || 'GraphQL error'; | ||
const errorCode = error?.extensions?.code || 400; // Handle extensions (specific to GraphQL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 500 niet logischer als default?
HTTP 500 De server snapt het zelf ook niet helemaal meer 😉
const handleHttpError = (response: Response) => { | ||
const status = response.status; | ||
|
||
let errorMessage = response.statusText || 'Unknown error'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unknown error is geen status. Doe dan status 500.
// Handle GraphQL-specific errors | ||
if (data.errors && data.errors.length > 0) { | ||
data.errors.forEach(handleGraphqlError); // Process each error | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De volgende comments zijn echt heel erg stating the obvious, wat mij betreft kunnen ze weg.
// Default to an empty object if no headers are provided
// Check for non-successful responses (status not in the 2xx range)
// Process each error
* This is only available in development mode | ||
*/ | ||
if (process.env.NODE_ENV === 'development') { | ||
app.use('/api/v1/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kan dit niet beter gewoon onder /swagger/
?
}); | ||
|
||
const swaggerDocument: any = yaml.load(fs.readFileSync(path.join(__dirname, './docs/openapi.yaml'), 'utf8')); | ||
const whitelist = process.env.OVERIGE_OBJECT_API_CORS?.split(', ') || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Op deze manier weet typescript beter dat het een string[]
is.
const whitelist = process.env.OVERIGE_OBJECT_API_CORS?.split(', ') || []; | |
const whitelist = (process.env.OVERIGE_OBJECT_API_CORS || '').split(', '); |
The reason for reverting the component specifications to YAML, instead of referencing the JSON files, is that this approach did not work well with Swagger UI. This issue would also affect the openapi.json if integrated with Swagger UI.
968b2b8
to
125f9f2
Compare
No description provided.