As of August 2021, here are steps I followed: In your project folder do: 1. git init 2. git add . 3. git commit -m "first commit" 4. heroku create myapi 5. git push heroku master I followed the video and got git errors so I did it in this order and it worked.
Thanks so much Arslan my main bug was from package.json, i did not include the ""start": "node app.js" in the scripts object now everything works just fine for me.
Thank you. Actually most part of the video is about creating the simplest API on express.js from a JSON file 😀 and only last 20 seconds is about deploying on Heroku 😛
Thank you. Please don't post misinformation on the internet though, that is terrible for society. Please do better when informing. Michael Jordan is the goat. Again. Thanks for the video. It helped a lot!
My reaction to your first paragraph 😱😱😱😱 My reaction to your second paragraph thank you for enjoying the video But for real I'm glad you enjoyed the content
Cool but please note to use .gitIgnore file . The .gitignore file is a text file that tells Git which files or folders to ignore in a project. In this case all those files in the node_modules folders didn't have to be uploaded, and devs might wonder (in the real world) why they're hit with high bills.
@@arslan99 thank you for quick response, I appreciate it! It did not work for me to POST (I could only GET), but my setup was from another tutorial - maybe I did something wrong. Anyway, I have to figure it out how to make API that could be edited like fake one with JSON server.
@@Wojciech38 huh interesting, you could possibly ask chatgpt to help or stack overflow but without seeing any code I think I can't quite give any solid advice 😅
Thank you Sir, I deployed my express.js apis successfully to heroku, but Sir let say i add new apis in my project so do i need to push changes using the exact command ? like we did git push heroku master for the 1st time.
Hi! Thanks for the video! i have my api deployed with heroku but cant access the routes. i keep getting an application error and my page could not be served. on my local host i access these routes just fine!. Do you know what might be wrong? i'm using mongoDb as my database
I created a node js express API and one of the endpoints takes a lot of time to get response data as it awaits google's lighthouse data hence Heroku is displaying "H12 request timeout" error. I think Heroku's request time out is just 30 seconds and as my API endpoint is taking more than 30 seconds, it's hanging up. Is there a way to deal with such issues?
idk who's gonna see this but this is wut the current issue is i have an express api that fetches data through scraping then when hitting the '/' it returns the data 1. it works locally and returns data 2. it doesn't return me any data when deployed to heroku, just an empty array
Hi arsalan, heroku just announced that they are ending their free tier plans and this is bad news now all of us have to move our project somewhere else please make a video on free tier alternative for Heroku
well according to the heroku docs the procfile is a text file in the root directory of your application, to explicitly declare what command should be executed to start your app. So I would think deleting it not give heroku any idea of how to run the app haven't tried it myself but thats what im thinkin'.
I did the same but now don't know how but it's crashed nothing is working now eg.react installation or anything else. Please help if someone know solutions for this.
SOLUTION: create heroku project via the command line by entering: "git init" to set up the git repository, "heroku login -i", logging in via the command line and then entering "heroku create ${project_name}", which will edit config.java in your git repository to add heroku
I can get an api up on heroku, but when I try to fetch from it I get error messages. Is there any tutorial where we get to see how to properly fetch from heroku as well?
Thanks for the video i have recently deployed on heroku, but the initial web page loading is quite slow, checked on google as it says use compression but not sure how i can od it , any suggestions please.
@@arslan99 I did add a start script for node but if I dont start my node server locally, the app wont work. Do we have to constantly keep node server up and running on local machine ?
@@opeomiwade9983 I'm not sure I can't Guarantee that but please check out this playlist it's a free db where you can host your db and everything Back4App: ruclips.net/p/PLxt4i7QVE689JT8jpPMkggCEqS46VSb-y
@@opeomiwade9983 well you can use this tutorial www.back4app.com/docs/ios/parse-swift-sdk And then you can connect to the hosted API into your project hope that helps 😃
thankyou i'm getting following error , can you plz help me, how to resolve it ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'git.heroku.com/curdapinodejs.git'
My api is hosted on heroku.But sometimes is it showing error on loading application. and after few time it works automatically does it is a glitch or something ??
why are you guys using --save 🤣🤣 its automatically saved in the json file as a dependency it has been long deprecated by the way thanks buddy. Can you show how to deploy with mongodb?
Since Heroku removed their free tier you can now follow this tutorial i made for a free alternative. ruclips.net/video/p_Mzurmd_5A/видео.html
As of August 2021, here are steps I followed:
In your project folder do:
1. git init
2. git add .
3. git commit -m "first commit"
4. heroku create myapi
5. git push heroku master
I followed the video and got git errors so I did it in this order and it worked.
thanks. been tryna get a heroku build goin for hours. this finally got it to work. appreciate it!
mega Chad
@@salvadorscafati3190 GIGA chad.. wait no… MEGA chad…nah, he’s better than that… TERRA chad!
October 3 - 2022. It works, You are the best man!!!
I don't think you know how helpful this actually was. Thanks so much, explained a really blurred concept extremely clearly. Nice job.
Glad I could help!
Do "git init" before "git add ."
(For everyone having a bit trouble there , saving some time)
thanks this helped me
This is the fastest and perfect explanation on how to deploy on heroku
I'm glad I could help ya out 😃
I love kevin. He is so much better than the other players on durant!
Thanks so much Arslan my main bug was from package.json, i did not include the ""start": "node app.js" in the scripts object now everything works just fine for me.
Awesome glad it works now ☺️
Thank you.
Actually most part of the video is about creating the simplest API on express.js from a JSON file 😀
and only last 20 seconds is about deploying on Heroku 😛
Hehe yeah lol gotta make the tutorial cover all bases
This is one of the best videos I've seen in a while. I found it easy to follow along.
Glad it was helpful!
watched so many long tutorials and this short and simple tutorial is working
Thank You....
hey man,
thank you so much
you saved me from a whole nightmare situation
thanks ♥️
Very simple and straight forward. Thank your very much.
thank you so so so so much. you have no idea how frustrated I was.
Np
Cool and handy video, thanks! Nice to see the NBA example, I'm a NBA fan!
Thanks. I'm glad you enjoyed it. Haha me too 😃
Thanks bro.. Afterall i succeeded to deploy server 👐
Thank you so much, this was helpful!
Np glad I could help
Made my own proxy :=) Great video
No idea what that is lol but great job 🙌
@@arslan99 Im not sure if its right. But I use the web server to request data from another api. So i can use the heroku as proxy
Oh I see, interesting. I had no idea heroku could be used for that
Thank you. Please don't post misinformation on the internet though, that is terrible for society. Please do better when informing. Michael Jordan is the goat.
Again. Thanks for the video. It helped a lot!
My reaction to your first paragraph 😱😱😱😱
My reaction to your second paragraph thank you for enjoying the video
But for real I'm glad you enjoyed the content
Cool but please note to use .gitIgnore file . The .gitignore file is a text file that tells Git which files or folders to ignore in a project. In this case all those files in the node_modules folders didn't have to be uploaded, and devs might wonder (in the real world) why they're hit with high bills.
I agree. Guess I completely forgot that 😅
Hi, Thanks for the video. Quick Question: What is the JSON formatted you use?
What do you mean json formatted I used library to clean up my code called prettier
Thanks bro, this helped me out so much
Glad I could help
Thanks Bro very Much .May god Bless u . BTW in Prockfile i uses npm start
No worries bro. I was actually just about to release an update to this video cuz it may not work for everyone 😅
You are a legend!! Thank you very much!
Nah bro you're the legend 😤😤😂
how about "post" method? "GET" is working but "POST" is not working for me from heroku... "POST" is working from postman
I'm not too sure sorry
Thank you so much, just what I needed!
Thank you! This was very helpful!
Your welcome!
You Helped Me A LOT 🔥🔥🔥🔥🔥🔥🔥🔥
Glad to hear that!
thanks for everything !!! really cool stuff !
So whats the difference in bigger scale apps as you mentioned?
bigger scale apps should use something like AWS that has low latecny and great documenatation
Thank you. It helped.
Thank you, Sir
Np
Thank you so much !!
Np
thanks brother for your time ....
Thank you my friend. You helped me so much!! 🎉
Np
Very nice. Thank you
Np
Thanks a lot!
Np
Thanks bro..greeting from argentina
No worries
How can I get each array
Like if we have multiple names ur printing the whole json data right
I need to get one by one when webpage refresh
you can loop through it if thats what you mean
Is it possible to make POST HTTP methods in JS then so to add the data in Heroku?
You could use a axios call or fetch request but not entirely sure if Heroku takes post requests
@@arslan99 thank you for quick response, I appreciate it!
It did not work for me to POST (I could only GET), but my setup was from another tutorial - maybe I did something wrong. Anyway, I have to figure it out how to make API that could be edited like fake one with JSON server.
@@Wojciech38 huh interesting, you could possibly ask chatgpt to help or stack overflow but without seeing any code I think I can't quite give any solid advice 😅
Super helpful, thanks a load!
No problemo
Thank you Sir, I deployed my express.js apis successfully to heroku, but Sir let say i add new apis in my project so do i need to push changes using the exact command ? like we did git push heroku master for the 1st time.
Not too sure about that I think you can just push it since it's already configured with heroku
You'll need to repeat -
git add .
git commit -m "msg"
git push heroku master
Hi! Thanks for the video! i have my api deployed with heroku but cant access the routes. i keep getting an application error and my page could not be served. on my local host i access these routes just fine!. Do you know what might be wrong? i'm using mongoDb as my database
If it's working on localhost that's great but remember that it can only work for JSON data not a Mongo db I hope this helps
I have created APIs in express.js but instead of array i am storing my data in mongodb hosted on Mongo Atlas do i still need to App.json schema?
Honestly I have no idea I've never worked with Mongo
Great video!!
Glad you enjoyed it
I created a node js express API and one of the endpoints takes a lot of time to get response data as it awaits google's lighthouse data hence Heroku is displaying "H12 request timeout" error. I think Heroku's request time out is just 30 seconds and as my API endpoint is taking more than 30 seconds, it's hanging up. Is there a way to deal with such issues?
You can try the new video I made as an update to this video for updating an API to heroku
if your api taking 30 sec for data then you api is waste of time. Your api should end the response under 4 sec minimum.
Really, helped. Thanks
Np
Thanks man. so helpful!!!!
np! :D
can you make the same video but deploying on vercel?
I'ma be honest with you I have no idea what that is
@@arslan99 i meant to say vercel
Not too sure. But it's a good video topic that I may make idk when but I'll add it to my list
idk who's gonna see this but this is wut the current issue is
i have an express api that fetches data through scraping then when hitting the '/' it returns the data
1. it works locally and returns data
2. it doesn't return me any data when deployed to heroku, just an empty array
Pretty helpful, thanks!
np
Thanks buddy!
No problem!
hii , could you make a tutorial how to make the nodeJs is connecting to mysql database table please?
ruclips.net/video/SyaJSKklH0U/видео.html
Thank you
Np 😆
So much easier than following heroku's docs 🤦🏼♂️.
Thanks glad you liked it
Nice man, Thanks :)
Np
a random youtube video can save hours!
Haha 😂
is the node modules necessary to be upload on Github Or we can create a gitignore file
you can use a git ignore
Thank you so much!
Np
How would you make an API request from react to huroku? get,post etc.
would you use the huroku link in the same way you use local host locally?
you can use axios to make those requests :D
Hi arsalan, heroku just announced that they are ending their free tier plans and this is bad news now all of us have to move our project somewhere else please make a video on free tier alternative for Heroku
Yeah I just recently saw that. I'll see what I can do for y'all 👌
what should I do with the Procfile if there's a bunch of folders and js files?
well according to the heroku docs the procfile is a text file in the root directory of your application, to explicitly declare what command should be executed to start your app. So I would think deleting it not give heroku any idea of how to run the app haven't tried it myself but thats what im thinkin'.
5:10 Heroku part begins :-)
Buying court-side tickets to team Durant, fo sho
😎😎😎
But, What if someone who knows this heroku link? Does he access the data?
I'm that case you can always create an API key that won't allow just anyone to access your data
Very Good!
Thanks ☺️
I did the same but now don't know how but it's crashed nothing is working now eg.react installation or anything else. Please help if someone know solutions for this.
do you get any specific error?
when I try git push heroku master, it say that heroku isn't a repoitory
SOLUTION: create heroku project via the command line by entering: "git init" to set up the git repository, "heroku login -i", logging in via the command line and then entering "heroku create ${project_name}", which will edit config.java in your git repository to add heroku
you dont need git ignore ?
I'm not sure I remember Im sorry
Thank you so much
Np
i got cors error when trying to fetch api, how to solve it?
stackoverflow.com/questions/53875548/cors-problems-on-heroku
I can get an api up on heroku, but when I try to fetch from it I get error messages. Is there any tutorial where we get to see how to properly fetch from heroku as well?
This video will help
ruclips.net/video/kglgtu9uAQM/видео.html
I am having the same issue --it says it's a CORs Error.
How can I deploy an api where the Heroku URL can be used in a fetch request?
@@arslan99 How can I deploy an api where the Heroku URL can be used in a fetch request?
@@andystematz-breitling5609 I'm sorry I haven't delt with Heroku for a long time now. I don't know the answer to that 😕
Finally found it!! :D you
npm i cors
then add this to server.js
const cors = require("cors")
const app = express()
app.use(cors())
Thanks for the video i have recently deployed on heroku, but the initial web page loading is quite slow, checked on google as it says use compression but not sure how i can od it , any suggestions please.
From my small amount of time using heroku it's notorious for being slow idk if there is a solution unless you pay 😐
yes lebron is the goat indeed
I have a question. If I dont use Procfile, do I need to keep running node server all the time on my local machine ?
Not sure I understand your question. If you've hosted in heroku you no longer need to run your node server
@@arslan99 Does Procfile ensure that our node server will run on heroku ?
@@scofieldgamingyt I would think so. A while back I tried pushing to heroku without it and it wouldn't work.
@@arslan99 I did add a start script for node but if I dont start my node server locally, the app wont work. Do we have to constantly keep node server up and running on local machine ?
@@scofieldgamingyt are you trying to run this all locally and not on heroku? If you are then yea you would need to start the server locally
Would you mind making a video dockerizing mern and deploy to heroku? :)
I would but I didn't even understand half of the sentance lmao. Jk, im not 100% sure on how to use docker currently or mongoDB maybe in the future tho
im kinda lost in the part where you typed " git add . ", because mine doesn't do that
Do "git init" before you do "git add ."
thanks bro
No problem
I have an error: ! [remote rejected] main -> main (pre-receive hook declined)
Can u help me :(
Sorry I've never seen taht error before
Hi, does this work with github pages?
No idea
I don't think GitHub pages allows server side environments like nodejs. It's only meant for static sites.
im getting this error: failed to push some refs to 'heroku'
unfortunelty im not too sure sorry
loved it !!! :-)
Glad it helped
does it work if i use data.js instead of data.json
Well the json is a object of data so I don't think it would work 😊
thanks, you helped me to finish me assignment :)))
Lol glad I could help!
Thank you for this video, I god this message error "sh: 1: node-pre-gyp: Permission denied" .Could you help please?
Sorry I'm not sure what that error means
I get an application error when I try running the heroku app. do you know why?
I think it's due to Heroku removing their free tier
@@arslan99 if I were to subscribe for one of the paid tiers, would it work?
@@opeomiwade9983 I'm not sure I can't Guarantee that but please check out this playlist it's a free db where you can host your db and everything
Back4App: ruclips.net/p/PLxt4i7QVE689JT8jpPMkggCEqS46VSb-y
@@arslan99 I have watched this but I don’t know if it’s an API like the heroku one because I need to create an API for my swift project
@@opeomiwade9983 well you can use this tutorial
www.back4app.com/docs/ios/parse-swift-sdk
And then you can connect to the hosted API into your project hope that helps 😃
i am getting method not allowed what to do?
I think it's due to the fact that Heroku removed their free tier but im not too sure sorry
Can we host it together with a database, to work as an API for, say, English-Arabic dictionary?
I have an Excel file of dict.
I think you can not too sure how you would tho off the top of my head
*After deploying on heroku I can't do anything like POST, DELETE, PATCH but I can only GET data? Anyone like me? :'(*
I'm not too sure how to do that im sorry
Is Durant a team name?
A players last name. I must've accidentally made the key=team my bad 😅
thankyou
i'm getting following error , can you plz help me,
how to resolve it
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git.heroku.com/curdapinodejs.git'
Not too sure sry
Can i POST data into that
I'm not too sure sorry
bro im done with life... it isn't getting deployed. It has H10 503 ...error .god knows what it is
unfortuently I think its due to the fact the heroku removed their free tier T-T
8:24 how did u make i like that? mine is just in a single row
He probably has a json formatter chrome extension
yes google chrome automatically does that
not working
Which part is not working?
LeBron (or the GOAT) 😂
😂
MJ has something to say about that
THICCASSNODEAPI
Lmao
just so sad that heroku is too slow
Ikr 😞
My api is hosted on heroku.But sometimes is it showing error on loading application. and after few time it works automatically does it is a glitch or something ??
why are you guys using --save 🤣🤣 its automatically saved in the json file as a dependency it has been long deprecated
by the way thanks buddy. Can you show how to deploy with mongodb?
Huh had no idea thanks for letting me know
@@arslan99 no problem nice video you got a new subscriber! Can you include mongodb with this deployment? thanks
Not sure how to do that but I'll check into it and see if I can make it happen
türk müsün len
nope