Problem deploying an Node app

I'm trying to deploy a fullstack app, but it's my first time and I don't know what I'm doing wrong
47 Replies
Percy
Percy15mo ago
Project ID: 7dd7217c-8c47-4d87-a1ed-ba42da383cb5
Billy Campagnoli - Backend
7dd7217c-8c47-4d87-a1ed-ba42da383cb5
Brody
Brody15mo ago
set the appropriate root directory in the service settings
Billy Campagnoli - Backend
like this /railway.toml
Brody
Brody15mo ago
thats a file, not a directory do you know what a directory is?
Billy Campagnoli - Backend
a folder right?
Brody
Brody15mo ago
yes
Billy Campagnoli - Backend
but how? sorry to be a bother, but my problem is that I got 2 folders one for the backend and another one for the frontend So I'm really lost in this scenario
Brody
Brody15mo ago
yes, set the appropriate root directory in the service settings if you want to designate that service as the backend, then you set the root directory as /backend
Billy Campagnoli - Backend
Can I do both in the same deploy? meaning like back and front, or it's not possible?
Brody
Brody15mo ago
not ideal, youd need two services
Billy Campagnoli - Backend
Yes I know that it's not ideal, it's just for a demo I ussualy do like you said
Brody
Brody15mo ago
do two services, one for frontend, one for backend
Billy Campagnoli - Backend
So like create 2 projects in the dashboard and linked them between?
Brody
Brody15mo ago
no one project, two services
Brody
Brody15mo ago
then in each service youd set the appropriate root directory
Billy Campagnoli - Backend
Ok got it
Billy Campagnoli - Backend
Like this right?
Brody
Brody15mo ago
looks about correct
Billy Campagnoli - Backend
thanks, so, sorry to bother again, but now I got another problem
Billy Campagnoli - Backend
That for the frontend
Brody
Brody15mo ago
what framework did you do the frontend in
Billy Campagnoli - Backend
React & Typescript with vite Also the backend is in Ts
Brody
Brody15mo ago
can i see your repo?
Billy Campagnoli - Backend
GitHub
GitHub - Bfix40/ChatBox: A message App that copy the model from sla...
A message App that copy the model from slack and discord - GitHub - Bfix40/ChatBox: A message App that copy the model from slack and discord
Brody
Brody15mo ago
open a terminal in frontend and run npm i serve then set serve dist -s -n -L -p $PORT as your start command in the frontends package.json
Billy Campagnoli - Backend
ok it'll be like this correct? "scripts": { "start": "dist -s -n -L -p $PORT", "dev": "vite", "build": "tsc && vite build", "preview": "vite preview" },
Brody
Brody15mo ago
no read again
Billy Campagnoli - Backend
ok step 1) install serve, check, step 2) set the start command as serve dist -s -n -L -p $PORT The second part is the one that I don't see where I'm wrong Oh, one other thing, it's already building But crash in the deploy npm WARN config production Use --omit=dev instead.
frontend@0.0.0 start dist -s -n -L -p $PORT
sh: 1: dist: not found
Brody
Brody15mo ago
bruh look this over and carefully compare it to the start command i told you to use
Billy Campagnoli - Backend
🤐 ups Sorry Yahooo it works Thanks
Brody
Brody15mo ago
no problem!
Billy Campagnoli - Backend
And again sorry to bother, but unfortunately go for round 2 It's the backend 🙃
Billy Campagnoli - Backend
I put it like you told me
Brody
Brody15mo ago
and what errors are you getting
Billy Campagnoli - Backend
This one
Brody
Brody15mo ago
what is this little arrow
Brody
Brody15mo ago
Billy Campagnoli - Backend
I really dont know 0.0 That doesn't appear in my main project though
Brody
Brody15mo ago
well if i cant even click it, then railway wont be able to get that sorted please
Billy Campagnoli - Backend
Yes, wait a minute please I see that it's a problem with the github repo, I'm going to try to delete it and upload it again to see if it gives me the same error Finish, it was a problem with a auth I solved it, and now it is runnig The only Issue right now is that I have yet to configure my mongo DB XD
Brody
Brody15mo ago
that should be easy enough remember to use environment variables
Billy Campagnoli - Backend
I surely hope so I am a SQL guy 🙂 This is my first project with NoSQL But for the rest much obliged
Brody
Brody15mo ago
no problem, its what im here for
Billy Campagnoli - Backend
Five stars for you my friend