Having issues with Heroku deployment - node.js

I am trying to upload a MEAN stack app for the first time, so I am not sure I am doing it the best way but here it is.
I have deployed my nodeJS server to one domain and it seems to be working fine - response message
but I am having problems with the client part.
I deployed the angular code to a different domain (not sure if that's how you do it) and I am getting this error:
error link
Here is a link to my github project repository if it could provide some more information - https://github.com/igalM/igal-school
I used the Heroku CLI and Container Registry to upload the code with Dockerfile.
Thank you in advance!

Looks like I just had to add a server.js to my client folder. SOLVED!

Related

FormData submit NodeJS returns 503 unavailable

I'm trying to deploy my application to Heroku (as usual) and I keep getting 503 Service Unavailable when trying to upload anything through my router handler (Multer)!
it's not related to any packages since I tried different projects with and without multer and the same return
Hi #Mahmoud Nasr,
Kindly run the nodejs code locally in system and check for any issues.
If it works then the issue is with Heroku server configurations or the
server is not available.
If it not working in local in the first place kindly update the snippet,
let's figure it out.
Regards,
Muhamed

Heroku deploy Cannot / Get

I am trying to deploy my MEAN application to Heroku. The deploy is successful but when i am opening my applicaton i get an error CANNOT / GET. When i check the console the followings i get
Error.
I have tried to configure the package.json several times but it didnot help. You can check it from my commits.
Here is my github repo.: https://github.com/urgyanmiki/AngularApp
Thank you very much!
Your package.json is starting the server.js of your backend. But you don't have a server.js for your frontend to receive requests.
I would suggest that you split your apps and deploy two apps to Heroku to see if everything is working. Afterwards you can still combine them into one app if you like.
You can follow this example to see what Heroku expects for the server.js of your frontend: Medium article

Deployed angular project 'GET' request not working

I have an built angular project that I'm trying to run. I have copied the folder that I got from 'ng build' and put it in the folder where I have my back end code (used express). I'm running it on my laptop at port 3000.
While all the post requests in my application work fine, none of the GET requests seem to work.
Here is the exact error I'm getting.
If more information is needed to find out what I'm doing wrong, please ask.
Edit 1:
This is what I'm getting in the network tab. The response says html. But when I was working before deployment all my responses were coming as intended.
After looking into the images that you mentioned here, it look like that is has a http failure duing parsing in header:
Take a look here in order to resolve the same:
https://github.com/angular/angular/issues/18396
Thanks

How do I deploy Apollo client and Node Express/Sequelize API?

I have an Apollo app with an express/sequelize API. It runs fine in dev. Can anyone tell me what it should look like in prod? Ive added .env environment variables. Where do those get set on the web server? Do I change the url in Apollo client? How do I build/prepare the API for deployment to web server through FTP? I use bitbucket for CI/CD. I really don't what I'm supposed to do.
So basically the answer is, with Node, you can't just deploy to a static server and expect it to work. The app created is already it's own server. Therefore, you have to host on in a service like AWS, Heroku or Now to get it to work. This may seem obvious to some but at first this wasn't clear to me.

backboneJS application runs fine in NodeJs but not in any other server?

I was trying to load a json file in Collection of BackboneJS. While trying to run this through nodeJS server, it works fine. But once put in a server environment like XAMPP or even in a remote server it does not work? Any link would be a nice help. ( For reference my code is at github : https://github.com/saumya/backboneJS-basics )
thanks
Hey thanks for the helping hand.
Probably I did not understand the situation, so the question is not correct as I see now.
The modified question is:
I have a frontend Application running on NodeJS server at some port.
I am trying to load JSON from another server running on another server.
The answer of #Floby is the way I solved it. Its the CORS thing on the server which provides the JSON. It took me sometime to understand what is happening.

Resources