While this lets us write slightly better tests, I don't think it's worth
the extra complexity. For example, it interferes with the creation of
test databases. We could work around this, but I'd rather keep things
simple.
fix: allow fastify to set content-type dynamically
We can set content-type: application/json for specific routes, but
doing so ends up with confusing, over-engineered code.
Instead we should take care when auditing the endpoints.
* test: allow mocking of env vars
Since utils/env is a module, we can mock it to control env vars in
tests. However, it's not compatible with building the server in
setupFilesAfterEnv, so, instead, we can use a utility function to keep
things DRY.
* fix: update type of fastifyTestInstance
* chore: add comment about sts preload
* chore: rename header plugin
* test: add get util + provide origin on request
* feat: add cors headers
* chore: add TODO
* chore: compile TS into /dist
Having the output co-located with the source meant that the js would be
imported by default. Given that we don't recompile on source changes,
this means the server got 'stuck' at the point of compilation and would
only register changes on build.
Also, compiling to a dist directory should make it easier to build when
we want to deploy. That said, the motivation is mostly DX.
* fix: put schema.prisma in the default location