Replies: 1 comment 1 reply
-
You need to do it in your HTTP server ( You could do it in entry.server at the module level (outside the exported function) but your RR app may not be imported by the server until a first request run, and in development it will be re-imported on every change. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to load and validate config from a file plus run some database stuff, aka async logic, and only run the rest of the server if both steps didn't throw.
Not sure where to put it though, the template has 3 "spots" to put:
server.js
I don't see the point of this file, plus it's not transpiled in the first place, which makes aforementioned procedures harder to use since they are written in typescript and are used in the code of the runtime server.
server/app.ts
This one sounded like a proper place, but it doesn't allow top level await which makes "validate, parse and continue" flow impossible. Plus it has a strange structure where symbols in this file are dynamically imported in
server.js
with no type hints, thus forcing to coordinate two parts for the same thing. And if I am going to have actual modules in here I have to make sure they aren't getting imported by the "main" code, since this path is not subject to.server
modules static analysis.hidden
app/entry.server.tsx
Pretty sure this one is called on each request, so out of the picture for my situation.
Beta Was this translation helpful? Give feedback.
All reactions