LOVE the video! it was quick, concise, and you werent constantly going back, like "oh, i think i have an error somewhere. im gonna spend 30mins looking for it and refuse to cut ahead".
Thanks a lot Raddy. This tutorial is awesome! You showed us how to easily deploy MongoDB and expressJS on Cyclic together. Looking forward new productive videos.
@@RaddyDev Hey, I have been tinkering around with the API and I'm trying to call it with a React frontend. I'm stuck. I can call up the books data with a browser, but not with my frontend (which I'm hosting on Netlify). I checked your website, but couldn't find anything: do you have a tutorial that makes a React frontend that calls an API hosted on Cyclic (which then gets data from a MongoDB database... i.e. a MERN application)?
I only have a few tutorials on React, but I would like to start creating some. Saying this I just started a personal project that uses the same stack, excerpt I use Firebase for the front end. Since you have your API working, in React you only need to use Fetch or Axios to get and display your data. I used Axios on mine. Look into your browser console when you fetch data with React and see the error. You will most likely encounter a CORS error. This would mean that your API cannot be accessed via another Domain. In NodeJs, is super easy to allow CORS. Download the package and use the basic functionality to set it up. Then you'll most likely be able to get the data. After that you can make it better and maybe make your API only accessibly from your front end application domain hosted on Netlify. That's so nobody can abuse your API. Always happy to help, let me know how it goes. I am looking forward of making React and NodeJs tutorials
Hey@@RaddyDev , I've been tinkering around some more. I was researching how to allow CORS, got sidetracked and found this solution: Add this route on the backend in index.js: app.all('*', (req, res, next) => { res.header("Access-Control-Allow-Origin", "*"); next() }); Then, on the frontend, add this in the src/App.js file: axios // accessing Raddy's api .get("[raddy's api]/books", {headers: {'Content-Type': 'application/json'}}) .then((response) => { console.log(response);; }); with these lines added, no more error and I can see the data fetched from MongoDB in the console. Now, I just have to figure out how to display it in the browser... If anyone has questions how I did it, please ask. I'll try to check on this reply.
Hi Bro First of all i'll appreciate your work i love it, i just wanted to know that what you are using to auto-complete the command in terminal just like github auto-pilot autocomplete-style suggestions as you code. thanks in advance
Powershell on Windows has a history of commands that I've entered before. Sometimes when I mess up the video and I have to re-record a the same part they pop up. Unfortunately it's nothing clever like autocomplete and thanks for the kind words
I tried to deploy the nodejs notes app on cyclic, but it's saying: The application failed to start. Node.js v18.16.1 ERROR: Failed to run "npm run start". Start script defined in package.json: "scripts": { "start": "node app.js" ...
Exited with code: 1 [CYCLIC] ERROR: No response from server on port 3000
Cyclic does things a little bit different. You might need to rename your 'app.js' file to either 'server.js' or 'index.js'. Then you have to make sure that mongoose.connect is finished before allowing your app to serve requests. In your case, it might be that you comment out: //connectDB(); and replace it with: //Connect to the database before listening connectDB().then(() => { app.listen(PORT, () => { console.log("listening for requests"); }) }) They do have a good example on their documentation that might help. Hopefully, the steps above will just work for you
@@RaddyDev did all the changes, but still getting errors. TypeError: OAuth2Strategy requires a clientID option at Strategy.OAuth2Strategy (/var/task/node_modules/passport-oauth2/lib/strategy.js:87:34) at new Strategy (/var/task/node_modules/passport-google-oauth20/lib/strategy.js:52:18) at Object. (/var/task/server/routes/auth.js:7:14) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Module.require (node:internal/modules/cjs/loader:1143:19) at require (node:internal/modules/cjs/helpers:110:18) at Object. (/var/task/index.js:52:14)
Best to look into their documentation as they might be doing something slightly different. They also have very active Discord page that you can check out. What error are you getting?
@@RaddyDev Yeah, i contacted them and they said cron jobs work differently on their server,hence, i have to alter my code to work that way...However, i need my app to work the way i want it to work, so i switched to render😀😇
Try Render. Their website is pretty good and they have a lot of great services that you can use. To deploy NodeJs you need to create Web Service, you'll see it once you login. Also you can create a PostgreSql DB there as well
Hii! I copied your tutorial step by step, but I keep getting Error: Failed to lookup view "list" in views directory "/var/task/views" when I try to open my URL link. Any ideas what I can do to fix this problem?
Do yo have that "list" file inside your views directory? Make sure you have the correct extinction - ejs, hbs, html... Whatever view engine that you are using
As default when you make changes to your GitHub repo it will redeploy automatically. You can also change your Auto Deployments from another branch if you wish. Look into the Environments tab, they have a lot of settings
LOVE the video! it was quick, concise, and you werent constantly going back, like "oh, i think i have an error somewhere. im gonna spend 30mins looking for it and refuse to cut ahead".
Thanks a lot Raddy. This tutorial is awesome! You showed us how to easily deploy MongoDB and expressJS on Cyclic together. Looking forward new productive videos.
Glad you enjoyed it!
Thanks so much for tutorial, since Heroku no linger free, it was great to find someone who shows how to use another platform
Glad it was helpful!
Was stuck for a while and found your tutorial. It worked. Thanks a lot!
Glad it helped!
@@RaddyDev Hey, I have been tinkering around with the API and I'm trying to call it with a React frontend. I'm stuck. I can call up the books data with a browser, but not with my frontend (which I'm hosting on Netlify). I checked your website, but couldn't find anything: do you have a tutorial that makes a React frontend that calls an API hosted on Cyclic (which then gets data from a MongoDB database... i.e. a MERN application)?
I only have a few tutorials on React, but I would like to start creating some. Saying this I just started a personal project that uses the same stack, excerpt I use Firebase for the front end. Since you have your API working, in React you only need to use Fetch or Axios to get and display your data. I used Axios on mine. Look into your browser console when you fetch data with React and see the error. You will most likely encounter a CORS error. This would mean that your API cannot be accessed via another Domain. In NodeJs, is super easy to allow CORS. Download the package and use the basic functionality to set it up. Then you'll most likely be able to get the data. After that you can make it better and maybe make your API only accessibly from your front end application domain hosted on Netlify. That's so nobody can abuse your API. Always happy to help, let me know how it goes. I am looking forward of making React and NodeJs tutorials
Hey@@RaddyDev , I've been tinkering around some more. I was researching how to allow CORS, got sidetracked and found this solution:
Add this route on the backend in index.js:
app.all('*', (req, res, next) => {
res.header("Access-Control-Allow-Origin", "*");
next()
});
Then, on the frontend, add this in the src/App.js file:
axios
// accessing Raddy's api
.get("[raddy's api]/books", {headers: {'Content-Type': 'application/json'}})
.then((response) => {
console.log(response);;
});
with these lines added, no more error and I can see the data fetched from MongoDB in the console.
Now, I just have to figure out how to display it in the browser...
If anyone has questions how I did it, please ask. I'll try to check on this reply.
Thank you Raddy, I've used your link to support you job
Great tutorial, easy to understand and follow, thanks for the effort!
Glad you enjoyed it!
Thanks bro, You have explained it clearly is short time.. I have also hosted my web-app with the help of this vedio
Thanks bro, You have explained it clearly is short time.. Thank ypu so much!
I appreciate the comment, thank you!
Thank You😊
Your video help me to deploy backend project
Glad to hear that
Amazing explanation Raddy! Thank you very much!!
My pleasure!
thank you for making this video it really helped me.
Hi Bro First of all i'll appreciate your work i love it, i just wanted to know that what you are using to auto-complete the command in terminal just like github auto-pilot autocomplete-style suggestions as you code. thanks in advance
Powershell on Windows has a history of commands that I've entered before. Sometimes when I mess up the video and I have to re-record a the same part they pop up. Unfortunately it's nothing clever like autocomplete and thanks for the kind words
Thank you so much, this was super helpful
Wow, this video was really helpful! Thanks you so much!
Glad it was helpful!
Very useful, Thanks
Thank you for this amazing video BRO ❤❤
I finally managed to deploy my app, thanks bro
No problem 👍
Helpful🤗
This video saved me!! Thank you so much.
You're welcome!
Thanks a lot for your video!
thank you nicely explained
Great video❤❤
Thank you so much! Very helpful!
Glad it was helpful!
very useful! Thank you!
Glad to hear that!
Yo man, thanks for this!
Happy to help!
Thank you so much !
You're welcome!
Awesome Man
Hey raddy, i deploy my crud app but when i create data, error read only how i can fix this?
Read only is making me think that your MongoDB user doesn't have full permissions. Check your MongoDB Database User Privileges. It could be that
I tried to deploy the nodejs notes app on cyclic, but it's saying: The application failed to start.
Node.js v18.16.1
ERROR: Failed to run "npm run start". Start script defined in package.json:
"scripts": {
"start": "node app.js"
...
Exited with code: 1
[CYCLIC] ERROR: No response from server on port 3000
Cyclic does things a little bit different. You might need to rename your 'app.js' file to either 'server.js' or 'index.js'. Then you have to make sure that mongoose.connect is finished before allowing your app to serve requests.
In your case, it might be that you comment out:
//connectDB();
and replace it with:
//Connect to the database before listening
connectDB().then(() => {
app.listen(PORT, () => {
console.log("listening for requests");
})
})
They do have a good example on their documentation that might help. Hopefully, the steps above will just work for you
@@RaddyDev did all the changes, but still getting errors.
TypeError: OAuth2Strategy requires a clientID option
at Strategy.OAuth2Strategy (/var/task/node_modules/passport-oauth2/lib/strategy.js:87:34)
at new Strategy (/var/task/node_modules/passport-google-oauth20/lib/strategy.js:52:18)
at Object. (/var/task/server/routes/auth.js:7:14)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object. (/var/task/index.js:52:14)
cron jobs in my code do not work on the cyclic server (though it works on local machine)....is there a fix for this please?
Best to look into their documentation as they might be doing something slightly different. They also have very active Discord page that you can check out. What error are you getting?
@@RaddyDev Yeah, i contacted them and they said cron jobs work differently on their server,hence, i have to alter my code to work that way...However, i need my app to work the way i want it to work, so i switched to render😀😇
Can I deploy project where I use elephantsqlDB+postgres ? or only MONGODB ?
You can do. The database that you use don't matter
@@RaddyDev Hi! Thanks for hepl.. ciclic is closed.. Can you recommend some alternative to deploy progects ?
Try Render. Their website is pretty good and they have a lot of great services that you can use. To deploy NodeJs you need to create Web Service, you'll see it once you login. Also you can create a PostgreSql DB there as well
Hii! I copied your tutorial step by step, but I keep getting Error: Failed to lookup view "list" in views directory "/var/task/views" when I try to open my URL link. Any ideas what I can do to fix this problem?
Do yo have that "list" file inside your views directory? Make sure you have the correct extinction - ejs, hbs, html... Whatever view engine that you are using
how to push changes to your deployed app in cyclic
As default when you make changes to your GitHub repo it will redeploy automatically. You can also change your Auto Deployments from another branch if you wish. Look into the Environments tab, they have a lot of settings
Does our node app have acces to the internet
Yeah widely available. Anybody can access it once is online
why my app don't save session after i logged in successfully
Which app is that? What are you using to save your sessions?
hey bro i got this error after deploying
"Cannot find module 'mongoose'"
That's a strange one. Can you make sure that you have mongoose installed and you can see it in your package.json file? Check for typos as well
cyclic is shutting dow and it does not have ssh protocol anymore!
Yep, sad. Render is another free option
thx a lot buddy
Any time
i want code please
Added the link under the description
hello ! will it work for ejs?
Hello! Yeah it will. You might want / have to store some of your static assets on another platform
bro , thanks a lot,
Always welcome
7:10 / 13:40
cyclic not installing express
When you deploy your project, what is the error that you get? I've had many express projects on cyclic, it should work
thanks!
No problem!
Please help me to deploy my handlebars (templating engine) , express, node. Js, mongodb website
@@vikasmenghani2477 Sure, what do you need help with? Do you get an error? The process should be exactly the same
genuine
Amazing! Thank you so much.
Thanks a lot!!
You're welcome!
Thanks a lot !!!
No worries!
THANK YOU