Full Stack Project Tutorial | Build a Recipe App for your Portfolio using React Node & PostgreSQL

  Рет қаралды 28,116

Chris Blakely

Chris Blakely

Күн бұрын

Пікірлер: 99
@ChrisBlakely
@ChrisBlakely Жыл бұрын
If anyones having an issue with API_KEY not found, heres a few things to try: - Make sure the .env file is in your backend folder, and named properly e.g `.env` (easy to forget the full stop at the start) - make sure the API_KEY variable is correct in your .env file, no spaces etc - You can try moving the variable into each function individually to see if that works If none of that helps you can just paste your API_KEY into the code to get over that blocker and continue with the tutorial. Be careful to avoid checking this into Git though!
@aminebenchouche6316
@aminebenchouche6316 Жыл бұрын
Hi, I had an issue with API_KEY and this line of code inside recipe-api.ts file resolve this issue require('dotenv').config();
@jakobfrederikson5808
@jakobfrederikson5808 Жыл бұрын
Hi everyone, I made sure to be in the backend/ folder and then installed dotenv with this command: npm i dotenv I then used import "dtoenv/config" at the top of both my recipe-api.ts and index.ts files.
@soujnyaar5560
@soujnyaar5560 Жыл бұрын
​@@jakobfrederikson5808Thank you
@danielcastillo289
@danielcastillo289 Жыл бұрын
adding the import "dotenv/config" line above the import * as RecipeAPI in the index.ts file was what fixed it for me. Hope this helps.
@sean_thw
@sean_thw 8 ай бұрын
@@danielcastillo289 thanks:)
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Thanks for watching! Should I make a discord server? Comment or Like if you agree 👇
@sean_thw
@sean_thw 8 ай бұрын
please do!
@THEMEATMISSLE74
@THEMEATMISSLE74 8 ай бұрын
Did you ever end up making a discord server?
@myelibrary
@myelibrary Жыл бұрын
I’ve just found another guy who explains difficult concepts in an extremely clear way. Chris is right up there with my other two favourite developers, Kyle from web dev simplified and net ninja . Keep those videos coming 🎉🎉
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Wow thanks for the awesome feedback ! And thanks for taking the time to watch, see you in the next one !
@durgfestivalvibes
@durgfestivalvibes 6 ай бұрын
1 hr done , and I would say explanation is so simple and easy to understand!!! Thanks!
@shilpas9515
@shilpas9515 Жыл бұрын
Thank You so much for this project. It helped me understand about the overall flow between frontend and backend. Subscribed. Is it possible for you to make a small video on how to deploy this to netlify or some other platform?
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Thanks for watching! In my next video I will show how to deploy a fullstack app, the video will be ready in a week or so. I am using Render, which is a good free option to look into
@shilpas9515
@shilpas9515 Жыл бұрын
@@ChrisBlakely Thank you so much. Looking forward to it :)
@fightscene817
@fightscene817 Жыл бұрын
Outstanding project! Thank you. Could you please consider working on NextJS projects in the future?
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Yep! its on my todo list 😀
@fightscene817
@fightscene817 Жыл бұрын
champion@@ChrisBlakely
@ajeigbejohnoluwaseyi8458
@ajeigbejohnoluwaseyi8458 11 ай бұрын
Great job Chris!
@mahendranath2504
@mahendranath2504 Жыл бұрын
Nice thank you, liked and subscribed
@nachiketgomkale5400
@nachiketgomkale5400 11 ай бұрын
Deployement part is missing
@ChrisBlakely
@ChrisBlakely 11 ай бұрын
Deployment isn’t part of this tutorial
@SaintHanappi
@SaintHanappi Жыл бұрын
Absolutely amazing. As a newbie in tutorial-hell I am happy i "found" your content. THANK YOU. Abo 🔛
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Thanks so much for the amazing feedback, I’m glad you found this helpful ! See you in the next one !
@Sanjanaa.b
@Sanjanaa.b Жыл бұрын
I've tried all possible ways that you mentioned regarding API_KEY not found issue, - .env is in the right folder with the right name - API_KEY variable is correct without any spaces - tried placing process.env.API_KEY in place of apiKey everywhere but still not working and when I tried to console the API_KEY value, it is showing as undefined. is there any other resolution for this as I see many are facing the same issue.
@ChrisBlakely
@ChrisBlakely Жыл бұрын
try installing dotenv package and import it in index.ts
@Sanjanaa.b
@Sanjanaa.b Жыл бұрын
@@ChrisBlakely thanks! Importing dotenv worked.
@afif8488
@afif8488 Жыл бұрын
@@Sanjanaa.b I have this same problem, can you explain how to import the dotenv?
@ChrisBlakely
@ChrisBlakely Жыл бұрын
From the backend folder, you can do - npm i dotenv - then, in the index.ts file, at the top add `import "dotenv/config";`
@afif8488
@afif8488 Жыл бұрын
@@ChrisBlakely thanks! it's finally worked
@user-bl3px9bd6t
@user-bl3px9bd6t Жыл бұрын
Great job Chris. Learned a lot from this. By the way, is there a chance you would be able to demonstrate how to deploy this to production like in platform such as Render or Cyclic perhaps?
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Hey thanks for watching! Really glad you found it helpful. And yes, I'm working on my next project video where I'll show you how to deploy the MERN stack, this will include deploying the Node backend to Render. I hadn't heard of Cyclic before so thanks for sharing that with me! 🙌
@user-bl3px9bd6t
@user-bl3px9bd6t Жыл бұрын
@@ChrisBlakely Hi Chris. I was trying to deploy the app in render, however I keep getting the error "Prisma only supports Node.js >= 16.13. Please upgrade your Node.js version." even though my node is already at version 18. Would you have any idea on why I'm getting the error?
@ChrisBlakely
@ChrisBlakely Жыл бұрын
so how this works is Render will start a virtual machine on their servers, install Node, dependencies etc and then try and start your app. Without looking too much into it, I imagine that Render is defaulting to an older version of node - there might be a setting somewhere that defines the Node version you want it to use
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Heres a doc I found that looks like it might be useful -> render.com/docs/node-version
@matthewkk5087
@matthewkk5087 Жыл бұрын
what a great project I would create it in angular. looks good
@bukanidamanmu4489
@bukanidamanmu4489 Жыл бұрын
Insane, u are awesome 🎉🎉🎉🎉
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Thanks for watching!
@FacelessYT300
@FacelessYT300 5 ай бұрын
Does anybody have an issue with signing up with the spoonacular api and éléphant sql is no longer active
@seriousy_un-pithy
@seriousy_un-pithy 15 күн бұрын
Would you mind putting a list of the packages you need to have installed before starting this? IE Node, TS, etc. I was finding myself having to stop every 30 sec in the intro in order to install, verify and keep going. I think I am good now, but it might help the next learner.
@dystopian_1
@dystopian_1 9 ай бұрын
You are awesome friend! Please make another project of an Ecommerce site.
@regilearn2138
@regilearn2138 6 ай бұрын
Wow this is awesome. I would like request a project that use backend micro-services and frontend micro-frontend using MERN stack ,bcz now a days most of real world production app use this architecture. please consider mate.
@Abogida11
@Abogida11 6 ай бұрын
Hi Do you notice that ElephantSQL will stop its services as of January 2025, and before that they will not accept a new users as of May1, 2024,
@vatansrivastava7279
@vatansrivastava7279 Жыл бұрын
Don't forget to use authentication in your upcoming videos. This tutorial feels incomplete without auth
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Good idea 👍 thanks for taking the time to watch and leave feedback !
@DualHellGunz
@DualHellGunz Жыл бұрын
Hi, i have a problem within the backend folder where in the recipe-app.ts, the 'process' cannot be found, generating an error
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Hey What’s the error? Can you paste it here so I can get a look thanks
@kiarieray5975
@kiarieray5975 11 ай бұрын
Awesome tutorial. I've learned a lot. Thanks!! This might be silly question, but how did you deploy the app with both the backend and frontend to Github pages.
@ChrisBlakely
@ChrisBlakely 11 ай бұрын
I used Render to deploy it you can’t deploy node to GitHub pages it’s only for static site
@kiarieray5975
@kiarieray5975 11 ай бұрын
@@ChrisBlakely Maybe deploy isn't the right word. I meant push, in simple terms, how did you go about pushing the app to a Github repo. I tried using the usual git init, bla, blah git push origin (branchname) but it obviously it didn't work since that's not how one 'pushes' a react app to github.
@kiarieray5975
@kiarieray5975 11 ай бұрын
@@ChrisBlakely Long story short I want the source code to be in a github repo, then I'll deploy it to render...
@ChrisBlakely
@ChrisBlakely 11 ай бұрын
@kiarieray5975 create a new repo on GitHub , and it’ll tell you instructions and commands to run
@kiarieray5975
@kiarieray5975 11 ай бұрын
@@ChrisBlakely Nvm, I was able to figure out what the issue was....
@kitembe
@kitembe Жыл бұрын
Can I free host this? say using netlify?
@ChrisBlakely
@ChrisBlakely Жыл бұрын
You can host the frontend on netlify yes, you can use something like Render or Cyclic to host your backend (node) and if you used ElephantSQL then your DB is hosted already. Will walk through this in my next project I’m building
@manasmj
@manasmj 11 ай бұрын
Hey, I am not able to access the website you mentioned in the description. How can I download the starter files n all?
@ChrisBlakely
@ChrisBlakely 11 ай бұрын
updated the description with links to github repos
@deepsamanta6112
@deepsamanta6112 Жыл бұрын
How to resolve error 404 while executing till the part explained in 1:09:00
@MishEsser
@MishEsser 10 ай бұрын
I have the same error as well.
@MishEsser
@MishEsser 10 ай бұрын
Found the problem: If you are following the tutorial, in your API.ts (frontend folder), make sure to correct the url address. If you have "recipe" instead of "recipes" in the baseURL, then it should be "recipe" throughout (recipe-api.ts index.ts) it should be----- new URL("localhost:5000/api/recipe/search"); If you have plural "recipes" then make sure your URL address is new URL("localhost:5000/api/recipes/search") in every file;
@rishii0702
@rishii0702 9 ай бұрын
Error: Loading PostCSS Plugin failed: Cannot find module 'tailwindcss'
@laibatariq-tc2yq
@laibatariq-tc2yq 7 ай бұрын
Hey! elephantsql is shutting down what should i do now?
@lokeshnegi5051
@lokeshnegi5051 11 ай бұрын
will this project be responsive ?
@rambrian8953
@rambrian8953 Жыл бұрын
hi. i got the same error using the same port number on one application, how do you switch off the extra one ? thanks
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Hey, you can either close the other app that’s taking up the port or change the port that your recipe app runs on (in index.ts). If you change the recipe app port make sure the change the API endpoints in the UI when you get to those parts
@MrSjcris
@MrSjcris Жыл бұрын
thanks for video but why use so old technology like express ?? in 2023 ?? it's not have any changes .. what node version you use
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Express is still widely used by teams in production. If you understand the concepts behind API/route handling etc then it doesn’t make too much difference what framework you use whether it’s express, nest, koa etc as they’re all similar, albeit differences in terms of performance. This can be said for all frameworks
@marinaivanova7962
@marinaivanova7962 11 ай бұрын
Hi, when I try to push to the db I get an error - Can't reach database server..., can you help?
@ChrisBlakely
@ChrisBlakely 11 ай бұрын
Make sure the environment variable for your mongodb connection is correct with correct username and password. Make sure you whitelist the IPs in mongodb.com
@NidhiShah-d8l
@NidhiShah-d8l Жыл бұрын
I am trying to pass results in setRecipe("results") but it gives error: "Argument of type 'string' is not assignable to parameter of type 'SetStateAction'." Any suggestions on this?
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Remove the quotes from setRecipe(“results”) , ie to setRecipe(results) What’s happening here is you’re trying to set the actual text/string “results” rather than the results object , so typescript threw the error
@NidhiShah-d8l
@NidhiShah-d8l Жыл бұрын
const [recipes, setRecipes] = useState([]); const handleSearchSubmit = async (event: FormEvent) => { event.preventDefault(); try { const results = await searchRecipes(searchTerm, 1); setRecipes(results); } catch (error) { console.error(error); } }.. This is what my code looks like, but still give me same error. @@ChrisBlakely
@gembojones8243
@gembojones8243 Жыл бұрын
I have followed the 'Setup Backend' section and the server is running but I'm seeing 'Cannot GET /' rather than '{message: success!}'. Any suggestions for how to fix this? Thanks
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Usually that means you're trying to hit an endpoint your server can't find, double check the endpoint you added to the GET method on your server, and maybe check the port you're using as well. If all looks good can you possibly share your code (either a github or paste it here etc)
@gembojones8243
@gembojones8243 Жыл бұрын
@@ChrisBlakely error I'm getting now is server/port error. restarting and changing port doesnt seem to help. Error: [nodemon] 3.0.1 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: ts,json [nodemon] starting `ts-node ./src/index.ts` Error: listen EADDRINUSE: address already in use :::5001 at Server.setupListenHandle [as _listen2] (node:net:1829:16) at listenInCluster (node:net:1877:12) at Server.listen (node:net:1965:7) at Function.listen (/home/gembojones/my_projects/recipe-app/backend/node_modules/express/lib/application.js:635:24) at Object. (/home/gembojones/my_projects/recipe-app/backend/src/index.ts:13:5) at Module._compile (node:internal/modules/cjs/loader:1255:14) at Module.m._compile (/home/gembojones/my_projects/recipe-app/backend/node_modules/ts-node/src/index.ts:1618:23) at Module._extensions..js (node:internal/modules/cjs/loader:1309:10) at Object.require.extensions. [as .ts] (/home/gembojones/my_projects/recipe-app/backend/node_modules/ts-node/src/index.ts:1621:12) at Module.load (node:internal/modules/cjs/loader:1113:32) { code: 'EADDRINUSE', errno: -98, syscall: 'listen', address: '::', port: 5001 } [nodemon] app crashed - waiting for file changes before starting...
@ChrisBlakely
@ChrisBlakely Жыл бұрын
so it looks like you're trying to use port 5001 but its in use somewhere else: Error: listen EADDRINUSE: address already in use :::5001 you can stop the app that is using 5001 or use a different port in your recipe app
@gembojones8243
@gembojones8243 Жыл бұрын
@@ChrisBlakely it is now working thanks :)
@gembojones8243
@gembojones8243 Жыл бұрын
@ChrisBlakely I had the same API key issue as you at 40:40, I installed the dot env package 'npm i dotenv' in the backend folder but hasn't fixed it and getting the same error, any ideas? Thanks server running on localhost:5000 /home/gembojones/my_projects/recipe-app/backend/src/recipe-api.ts:5 throw new Error("API key not found"); ^ Error: API key not found at Object.searchRecipes (/home/gembojones/my_projects/recipe-app/backend/src/recipe-api.ts:5:13) at /home/gembojones/my_projects/recipe-app/backend/src/index.ts:14:37 at Layer.handle [as handle_request] (/home/gembojones/my_projects/recipe-app/backend/node_modules/express/lib/router/layer.js:95:5) at next (/home/gembojones/my_projects/recipe-app/backend/node_modules/express/lib/router/route.js:144:13) at Route.dispatch (/home/gembojones/my_projects/recipe-app/backend/node_modules/express/lib/router/route.js:114:3) at Layer.handle [as handle_request] (/home/gembojones/my_projects/recipe-app/backend/node_modules/express/lib/router/layer.js:95:5) at /home/gembojones/my_projects/recipe-app/backend/node_modules/express/lib/router/index.js:284:15 at Function.process_params (/home/gembojones/my_projects/recipe-app/backend/node_modules/express/lib/router/index.js:346:12) at next (/home/gembojones/my_projects/recipe-app/backend/node_modules/express/lib/router/index.js:280:10) at cors (/home/gembojones/my_projects/recipe-app/backend/node_modules/cors/lib/index.js:188:7) [nodemon] app crashed - waiting for file changes before starting...
@sandeepmukherjee8927
@sandeepmukherjee8927 Жыл бұрын
Hey Chris I have completely coded the app in javascript react and I am facing a problem in which my heart icon is not changing. please guide me on the same
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Probs best to look at the source code and see where you might have gone wrong: github.com/chrisblakely01/react-node-recipe-app check to see if your favourites array is populated correctly, can do this with console.log or use react devtools. If so double check the logic that checks the favourites array and determines whether the recipe is favourited or not. Finaly check the actual component logic to make sure its rendering the heart/heart outline depending on isFavourite
@sandeepmukherjee8927
@sandeepmukherjee8927 Жыл бұрын
@@ChrisBlakely I have checked my code with yours multiple times but the problem is still present. I think when you are passing the isFavourite prop to the recipe card, when the react app re-renders it can't keep track of the previous value instead there should be a useState to toggle the isFavourite variable.
@sarabibrahim8312
@sarabibrahim8312 6 ай бұрын
👏👏👏
@MuhammadRidwan-kq4yw
@MuhammadRidwan-kq4yw 9 ай бұрын
ts i wish you just use js for it :(
@dalestewart
@dalestewart 8 ай бұрын
elephant.sql will be discontinued by 2025
@kensei1412
@kensei1412 Жыл бұрын
I got an error like this: Uncaught TypeError: Cannot read properties of undefined (reading 'map') The Map Function: {recipes.map((recipe) => { const isFavourite = favouriteRecipes.some( (favRecipe) => recipe.id === favRecipe.id ); When i check the value of the recipes: console.log("Recipes:", recipes.results); result on console: Object code: 402 message : "Your daily points limit of 150 has been reached. Please upgrade your plan to continue using the API." status: "failure" Object Is there a solution for this when we reach the limit of the API?
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Few things to try: - you can copy an example response from the docs and paste it into your server code, then return this response instead of making a request to the real recipe API. This is good if you want to test things without having to make a request to the real recipe API - you could create another account etc but thats a bit tedious. I think the credits reset after a day
@rambrian8953
@rambrian8953 Жыл бұрын
I keep having this problem loading the page keeps crashing and giving me this two error messages backend/src/recipe-api.ts:7 throw new Error("API key not found") --- [nodemon] app crashed - waiting for file changes before starting... after putting the "await" - key word at the try catch' and after i had installed -dotenv-
@ChrisBlakely
@ChrisBlakely Жыл бұрын
Hey, few things to try: - Make sure the .env file is in your backend folder, and named properly e.g `.env` (easy to forget the full stop at the start) - make sure the API_KEY variable is correct in your .env file, no spaces etc - You can try moving the variable into each function individually to see if that works If none of that helps you can just paste your API_KEY into the code to get over that blocker and continue with the tutorial. Be careful to avoid checking this into Git though!
I tried 8 different Postgres ORMs
9:46
Beyond Fireship
Рет қаралды 443 М.
How to build a React + FastAPI application (Full Stack Guide)
51:07
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
Node.js: The Documentary | An origin story
1:02:49
Honeypot
Рет қаралды 684 М.
PERN Stack Course - Postgres, Express, React, and Node
1:22:45
freeCodeCamp.org
Рет қаралды 528 М.
Видео 1: Java21 Maven + SQL Docker + JPA Hibernate
31:01
Java, SQL и Spring
Рет қаралды 1,9 М.
Want to make a video chat app? Watch this video for WebRTC!
1:22:35
Good Morning Developers
Рет қаралды 48 М.
Evolute I-Space - ты просто космос Стас!
19:35
Клубный сервис
Рет қаралды 74 М.
Мастер и Мандарины - Уральские Пельмени
1:34:39
Уральские Пельмени
Рет қаралды 966 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН