Closed wu-lee closed 1 month ago
This whole branch has been rebased to the end of main
and some minor conflicts resolved (just package-lock.json)
Some extra things to note. As well as fixing-up those things as requested, I found some other problems and addressed them too. These were:
http://localhost:3000
. Hope t this isn't annoying, but I needed to adjust this back to use the environment variable VITE_API_URL
in order for both the back-end in a production-mode installation to work, and npm run start
on the front-end, as they both need to get the API from elsewhere. Therefore I think you will need to set this variable explicitly now for npm run dev
to work with the back-end on http://localhost:3000
. (Similarly, you need to set this to /api
for npm run start
to work, see notes below.) Possibly this could be set in the dev
runscript via cross-env VITE_API_URL=http://localhost:3000
, this works but I hesitate to add it without conferring first)prefix
option, which breaks production mode. I needed to correct this in the back end, with knock-on corrections in the front end.As I said earlier, I plan to flatten these corrections into the appropriate commits before merging. I'm not sure if it's easier for you to review before or after that, so let me know if you want me to do that first.
I've tested npm run dev/start/build
on the front end, and npm run dev/build/test
on the back end. These seem to work as expected now.
To test npm run start
you need to set VITE_API_URL=/api
in the front-end environment before building. It then mimics the way the app will run when deployed in production, when the API is served from /api
.
You can check this is working by:
test-A
dataset rendered on the mapSetting SERVER_DATA_ROOT=test/data
(or an equivalent) in the back-end environment isn't necessary in development (npm run start
), but is necessary in production. Of course an alternative location can be used, pointing to different data. Our new back-end implementation, when it arrives, should continue to respect this option, as this is used by the production deployment to define where the data is.
@wu-lee Thanks, this is looking good.
cross-env VITE_API_URL=http://localhost:3000
and cross-env VITE_API_URL=/api
to the runscriptsFixes for above changes requested now added as fixup commits above, then the branch rebased on to the current main
branch to verify it can be integrated.
Then fixups squashed into relevant commits, or promoted to primary commits, as appropriate.
Result rebased again to integrate a fix added to main branch.
What? Why?
Related to issue #6
This PR converts the back end from using the
fastify-openapi-glue
implementation to an equivalent one using the newts-rest
based contract. It also fixes the test suite (such that there is) and adjusts the contract to match the API in use, in particular with respect to the errors (they now return messages), the dataset ID (it's now a number) and the version endpoint (the response is more specific, not just a pass-through).What should we test?
dev
andbuild
front and back end) and that intellisense works in your editor.common
package to ensure the contract is up to dateChecklist
Updated or added any necessary docs inI dont think the documentation there needs additions? I have however included TSDoc style comments to the new code I've added.docs/
Added UTs(Not applicable)Deployment notes