Help with connecting my project made in html,css & js with nodejs has the backend....
richardpinewood
HOBBYOP

a year ago

Hello guys,so i am creating a fitness website and i wuant to host it online just for myseelf to test it out so i can have a prespective on how it would work if i was in the user side,i decied to use railway to host the backend ,and netlify for the frontend ,but i am having some problems to connect the backend unfortonely,i think i have connected the database but i dont am really sure if i did it right,can someone help ?

69 Replies

a year ago

what issues are you running into?


richardpinewood
HOBBYOP

a year ago

N/A


richardpinewood
HOBBYOP

a year ago

hiii


richardpinewood
HOBBYOP

a year ago

so ,the thing is that this is happening

1287795995815579600


a year ago

please share your repo


richardpinewood
HOBBYOP

a year ago

sure


richardpinewood
HOBBYOP

a year ago


richardpinewood
HOBBYOP

a year ago

i rooted in railway to /backend but still not working


richardpinewood
HOBBYOP

a year ago

everything is in the same project


richardpinewood
HOBBYOP

a year ago

the backend and the frontend


a year ago

you dont have a package.json and package-lock.json in that backend folder


richardpinewood
HOBBYOP

a year ago

what do you mean ?


richardpinewood
HOBBYOP

a year ago

do i need to add that ?


a year ago

yes those are node specific, without those nixpacks wont know what to do with this backend project


richardpinewood
HOBBYOP

a year ago

they are in my project but not on github

1287796856511791000


richardpinewood
HOBBYOP

a year ago

do i need to add them to github ?


a year ago

you need them in the backend folder too and they need to be in github


richardpinewood
HOBBYOP

a year ago

so how could i fix this ?


a year ago

create the files in the backend folder


richardpinewood
HOBBYOP

a year ago

is there a command ?


richardpinewood
HOBBYOP

a year ago

i mean they were installed automatically


richardpinewood
HOBBYOP

a year ago

oh wait i did npm init y


richardpinewood
HOBBYOP

a year ago

but wont it affect the project ?


a year ago

you need them in the backend folder


richardpinewood
HOBBYOP

a year ago

because i will have two files…. wotj the same name


a year ago

^


richardpinewood
HOBBYOP

a year ago

will it be fine ?


a year ago

considering its current broken, you cant make it worse, you need them, there is no two ways about that


richardpinewood
HOBBYOP

a year ago

hmmmm


richardpinewood
HOBBYOP

a year ago

what is going on now ? Error: Cannot find module 'express'

Require stack:

  • /app/server.js

    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)

    at Module._load (node:internal/modules/cjs/loader:981:27)

    at Module.require (node:internal/modules/cjs/loader:1231:19)

    at require (node:internal/modules/helpers:177:18)

    at Object. (/app/server.js:1:17)

    at Module._compile (node:internal/modules/cjs/loader:1364:14)

    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)

    at Module.load (node:internal/modules/cjs/loader:1203:32)

    at Module._load (node:internal/modules/cjs/loader:1019:12)

    at Function.executeUserEntryPoint as runMain {

    code: 'MODULENOTFOUND',

    requireStack: [ '/app/server.js' ]

}

Node.js v18.20.2


richardpinewood
HOBBYOP

a year ago

it is appearing in railway logs


a year ago

you need to have all your needed dependences in your package.json


richardpinewood
HOBBYOP

a year ago

what dependencies ?


a year ago

well an example would be express for one


richardpinewood
HOBBYOP

a year ago

if i install express will railway know ? or even github form my machine ?


a year ago

it will install it because its listed in your package.json


richardpinewood
HOBBYOP

a year ago

did it finished ???

1287814787144618000


richardpinewood
HOBBYOP

a year ago

finnally i installed all depencies


richardpinewood
HOBBYOP

a year ago

@Brody


a year ago

yes it says active, now you need to generate a domain


richardpinewood
HOBBYOP

a year ago

for what ?


richardpinewood
HOBBYOP

a year ago

in railway ?


richardpinewood
HOBBYOP

a year ago

you mean in the frontend ?


a year ago


richardpinewood
HOBBYOP

a year ago

will the domain serve for netlify ?


a year ago

this will be the domain for your backend


richardpinewood
HOBBYOP

a year ago

i see a domain in Private Networking


a year ago

you need to generate a public domain


richardpinewood
HOBBYOP

a year ago

i see


richardpinewood
HOBBYOP

a year ago

can i choose a domain i like ?


a year ago

yes


richardpinewood
HOBBYOP

a year ago

doneee


richardpinewood
HOBBYOP

a year ago

were should i implement that domain in netlify ?


a year ago

your frontend code needs to call the domain, it would not have anything to do with netlify specifically


richardpinewood
HOBBYOP

a year ago

but i wont need later to do node server.js ?


richardpinewood
HOBBYOP

a year ago

if imagine i use netlify


a year ago

railway is running the server, not netlify


richardpinewood
HOBBYOP

a year ago

i knoww


richardpinewood
HOBBYOP

a year ago

but late one i wont need to do the command right ?


richardpinewood
HOBBYOP

a year ago

when i finish to integrate


richardpinewood
HOBBYOP

a year ago

the frontend and the backend online


a year ago

uh sure, i dont really understand the question / your english, sorry


richardpinewood
HOBBYOP

a year ago

imagine if i deploy the backend in railway,i wont need to use the terminal later ?


a year ago

i guess


richardpinewood
HOBBYOP

a year ago

@Brody do you know about vercel ?

1287863144286388200


richardpinewood
HOBBYOP

a year ago

i am trying to host my frontend in here but it is appearing me this error 404


a year ago

we can't provide support for platforms that arent railway


richardpinewood
HOBBYOP

a year ago

boomer


a year ago

i don't see how that is productive to the conversation, going to close this thread out.


Loading...