How do I hook up my frontend correctly./
I am able to deploy my backend but my frontend is not working yet.
Error:
32 Replies
Project ID:
3b4c3c14-6b11-4e8a-8f52-bb11ff2f2554
3b4c3c14-6b11-4e8a-8f52-bb11ff2f2554
GitHub
GitHub - hannarosenfeld/vault-manager
Contribute to hannarosenfeld/vault-manager development by creating an account on GitHub.
refresh me please, screenshot of your railway project?
do you have the root directory set to
/frontend
?and if you have any build or start commands set in the service settings, please clear them
yes
sorry i just saw i didn't it must have not saved. set it to /frontend now
cleared build / start commands
please copy the
Caddyfile
and nixpacks.toml
files from this repo https://github.com/brody192/create-react-app-starter into your frontend folderok done and pushed. redeploying now
you have a bunch of warnings and they are being treated as errors, you have two options, fix the warnings, or ignore the warnings and fix them later
I'll fix them later, they are referencing things I will use later
gotcha, set a service variable
CI
= false
done, getting this error now:
uhhhh
redeploy?
ok doing that now
exact same error after rebuild : /
can i see the full build logs, use this https://bookmarklet.up.railway.app/log-downloader/
that's pretty cool
thank you 🙂
use this in your frontend instead?
ok done and redeploying now
what was the removal of
BrowserRouter
for?I wasn't gonna use that one
It worked! Do I need to somehow connected my backend and frontend or are they connected now?
your frontend will need to know the domain to call for api requests, you can add this as a variable to the frontend service like so
REACT_API_URL
= https://${{RAILWAY_SERVICE_VAULT_MANAGER_BACKEND_URL}}
i think i spelt that correctly
i did the same type of thing here as a demo, this would be how that variable would look when in code https://utilities.up.railway.app/env-vars?prefix=REACT_thank you!! much appreciated
would i use the domain for the front or backend service ?
when i want to visit my site
youd need both services to have domains
but you would visit your site from the frontend domain
then your frontend would call your backend via the value from the
REACT_API_URL
environment variableawesome thank you!
no problem, if you have any more questions, feel free to ask