PERN stack deploying to Railway - node.js

Hi I've just finished a PERN project that I want to deploying using Railway, should be very easy according the people on the internet.
But I'm just so lost even to begin, I tried connecting to my Github, and I run into a an error already.
Then I wanted to try deploy my local postgres db first, so I set up the postgres db on railway, got the config pages and change my local postgres config to match railway...and then I'm lost
I tried searching on Youtuber and google, but it seems most people are either migrating from heroku, using django, or just not really showing how to deploy from beginning to end.
So I'm here looking for help to see if anyone could guide me to the right place (article or video) that actually shows or teaches how to deploy PERN stack to railway from step 1, which is after finishing the project locally.
A bit more info about the stack I'm using...
react 18
express.js
postgresql 14
node 16
BTW, I don't know if this is way I run into the first issue with Nixpacks, but I have my client (react) folder and server (express + postgres db) folder inside a project folder.
Thank you all so much, I appreciate all the help.

Related

How to deploy node.js app onto a production server?

im new to node.js and have struggled to find information about deploying apps.
Say that I have written a small one file node.js app and would like to deploy it onto a prod server. If I deploy the app.js file alone I cant use "node app.js" to run as the app is missing package.json and the node modules. But deploying all these files/folders to the server seems like the wrong way to do it as it would take ages to transfer all the node_modules.
The only resources that I can find online use localhost node server which doesn't really show what I need. I'm using MobaX to deploy to a specific IP if this is useful.
Sorry if this is a stupid question, most of my experience is in front-end so haven't had the opportunity to play around with this and don't have anyone to ask for guidance.
Please don't mark down the question, I will happily edit the question if any feedback on doing so is provided.

trouble deploying full stack application on heroku

I have made a full-stack app with react js and node js with express and MongoDB but I am having a little bit of difficulty deploying I first tried to deploy the front end but I was getting the invalid host header coming up when I tried to deploy in Heroku its been tested and works fine in the dev environment.
But also my application has two separate git repos one for the back and one for the front end and every tutorial I have seen to deploy they always have the client in the same folder as the server.
Can someone either tell me how to deploy or point me in the right direction on how to deploy.
What you have to do for React/Express/Node/MongoDB is,
build your frontend app first by using "npm run build". This will create a build folder under your app folder.
move your "build" folder to backend app folder.
update your backend app to use "app.use(express.static('build'))".
Then you can push your code to git and Heroku and try to deploy it.
There should be some tutorials available on Heroku website.

Deploying mono repo to Heroku, Node.JS, Angular 9. Heroku CLI

Having a bit of an issue with Heroku. I've always uploaded in one directory, but this time I wanted my folder structure to be a bit more, well structured. The problem is I can't seem to upload to Heroku like this.
I have a directory containing a folder called "client" which contains my angular 9 application and I have a folder called "middle-tier" containing the node.js server application.
I can't figure out how to push this up and allow it to work. The node application serves the angular application.
Everything works locally I just have no idea how to push this up to Heroku servers.
Please see attached screenshots of the structure.
Below is the error message I'm getting. Which I tried to fix by running git init again in the root of the structure. And then running the command to have a node.js build pack. Which was to no avail this also did not work and produced the same problem.
I have tried to include as much detail as I can but if there is anything else I can provide please let me know. I've spent quite some time building my application and am quite eager to deploy it!
Thanks for your time guys!
In short, with multiple discussions with Heroku support line, at the moment it is impossible to upload a mono repo to a single Heroku instance.

Angular 7 on nodeJS server referencing github

I have an angular 7 app that runs on NodeJS server. When I build my app from local and deployed it, it works fine.
However, after I committed the project to github, another developer cloned it. He created the build for NodeJS server, and now all the paths are pointing to github.
Screenshot from console
Did anyone experience the same? Please advise how to fix it.

Deploying and Running Node.js app in Cloud

I have a Mean stack node.js application and amazons remote desktop machine. I need to deploy my node.js application to amozon.
I have uploaded my files to wwwRoot folder. It contains a default index.html page.
After uploading files also, i got that same index.html display in browser.
Please let me know how i can deploy and run my node.js application.
Thanks in Advance
I highly suggest you follow a guide or tutorial to get yourself set up with a node.js web server. From your question is seems to me that you're missing some key points on how a node.js web server functions and there's really not a single answer to your question. I recommend you read up on the following tutorial:
https://blog.risingstack.com/your-first-node-js-http-server/
Good luck!

Resources