Configuring manual server with react router v7 #12621
-
I am trying to setup content security policy and I see for example in Kent's website which has remix and also in epic stack (https://github.com/epicweb-dev/epic-stack) which also uses remix, there's a server that can be configured and then csp can be setup on the express server. On remix docs, there's also manual mode (https://remix.run/docs/en/main/guides/manual-mode) which talks about configuring a manual server and this template shows an example with express (https://github.com/remix-run/remix/blob/main/templates/express). If I want to do a similar thing with react router v7, can I follow a similar instructions to what is in the remix express template to setup a custom server/manual mode or does react router v7 make significant changes or configuration to the dev/build and server setup in remix? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I think what you're looking for is the entry.server.tsx that we were used to in Remix. If so the react-router framework obfuscates that file and handles it for you. In the docs it says you can reveal it and make changes and I think that is how you would get the config you're looking for. The command is |
Beta Was this translation helpful? Give feedback.
-
Under react router templates repository, there's actually a custom node server example(https://github.com/remix-run/react-router-templates/tree/main/node-custom-server) that shows exactly how to do this. So I used that. It's just not easily referenced in the reactrouter documentation so took some digging to find it. |
Beta Was this translation helpful? Give feedback.
Under react router templates repository, there's actually a custom node server example(https://github.com/remix-run/react-router-templates/tree/main/node-custom-server) that shows exactly how to do this. So I used that. It's just not easily referenced in the reactrouter documentation so took some digging to find it.