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

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 98

  • @ChrisBlakely
    @ChrisBlakely  Год назад +3

    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 Год назад +6

      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 Год назад +4

      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 11 месяцев назад

      ​@@jakobfrederikson5808Thank you

    • @danielcastillo289
      @danielcastillo289 10 месяцев назад +4

      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 7 месяцев назад

      @@danielcastillo289 thanks:)

  • @ChrisBlakely
    @ChrisBlakely  Год назад +21

    Thanks for watching! Should I make a discord server? Comment or Like if you agree 👇

    • @sean_thw
      @sean_thw 7 месяцев назад

      please do!

    • @THEMEATMISSLE74
      @THEMEATMISSLE74 6 месяцев назад

      Did you ever end up making a discord server?

  • @myelibrary
    @myelibrary Год назад +4

    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  Год назад +2

      Wow thanks for the awesome feedback ! And thanks for taking the time to watch, see you in the next one !

  • @durgfestivalvibes
    @durgfestivalvibes 5 месяцев назад +1

    1 hr done , and I would say explanation is so simple and easy to understand!!! Thanks!

  • @shilpas9515
    @shilpas9515 Год назад +2

    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  Год назад +3

      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 Год назад +3

    Outstanding project! Thank you. Could you please consider working on NextJS projects in the future?

  • @SaintHanappi
    @SaintHanappi Год назад +1

    Absolutely amazing. As a newbie in tutorial-hell I am happy i "found" your content. THANK YOU.
    Abo 🔛

    • @ChrisBlakely
      @ChrisBlakely  Год назад +1

      Thanks so much for the amazing feedback, I’m glad you found this helpful ! See you in the next one !

  • @regilearn2138
    @regilearn2138 5 месяцев назад +1

    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.

  • @dystopian_1
    @dystopian_1 7 месяцев назад

    You are awesome friend! Please make another project of an Ecommerce site.

  • @user-bl3px9bd6t
    @user-bl3px9bd6t Год назад +1

    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 Год назад +2

    what a great project I would create it in angular. looks good

  • @Sanjanaa.b
    @Sanjanaa.b Год назад +3

    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  Год назад +1

      try installing dotenv package and import it in index.ts

    • @Sanjanaa.b
      @Sanjanaa.b Год назад +1

      @@ChrisBlakely thanks!
      Importing dotenv worked.

    • @afif8488
      @afif8488 Год назад

      @@Sanjanaa.b I have this same problem, can you explain how to import the dotenv?

    • @ChrisBlakely
      @ChrisBlakely  Год назад +1

      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 Год назад +1

      @@ChrisBlakely thanks! it's finally worked

  • @nachiketgomkale5400
    @nachiketgomkale5400 9 месяцев назад +2

    Deployement part is missing

    • @ChrisBlakely
      @ChrisBlakely  9 месяцев назад

      Deployment isn’t part of this tutorial

  • @Abogida11
    @Abogida11 4 месяца назад +1

    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,

  • @mahendranath2504
    @mahendranath2504 Год назад +1

    Nice thank you, liked and subscribed

  • @vatansrivastava7279
    @vatansrivastava7279 Год назад +3

    Don't forget to use authentication in your upcoming videos. This tutorial feels incomplete without auth

    • @ChrisBlakely
      @ChrisBlakely  Год назад +2

      Good idea 👍 thanks for taking the time to watch and leave feedback !

  • @ajeigbejohnoluwaseyi8458
    @ajeigbejohnoluwaseyi8458 10 месяцев назад

    Great job Chris!

  • @DualHellGunz
    @DualHellGunz Год назад +1

    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  Год назад +1

      Hey What’s the error? Can you paste it here so I can get a look thanks

  • @kiarieray5975
    @kiarieray5975 10 месяцев назад

    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  10 месяцев назад +1

      I used Render to deploy it you can’t deploy node to GitHub pages it’s only for static site

    • @kiarieray5975
      @kiarieray5975 10 месяцев назад

      @@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 10 месяцев назад

      @@ChrisBlakely Long story short I want the source code to be in a github repo, then I'll deploy it to render...

    • @ChrisBlakely
      @ChrisBlakely  10 месяцев назад

      @kiarieray5975 create a new repo on GitHub , and it’ll tell you instructions and commands to run

    • @kiarieray5975
      @kiarieray5975 10 месяцев назад

      @@ChrisBlakely Nvm, I was able to figure out what the issue was....

  • @manasmj
    @manasmj 10 месяцев назад

    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  10 месяцев назад +1

      updated the description with links to github repos

  • @bukanidamanmu4489
    @bukanidamanmu4489 Год назад +1

    Insane, u are awesome 🎉🎉🎉🎉

  • @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

  • @rishii0702
    @rishii0702 8 месяцев назад

    Error: Loading PostCSS Plugin failed: Cannot find module 'tailwindcss'

  • @FacelessYT300
    @FacelessYT300 4 месяца назад

    Does anybody have an issue with signing up with the spoonacular api and éléphant sql is no longer active

  • @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  Год назад +1

      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

  • @marinaivanova7962
    @marinaivanova7962 9 месяцев назад

    Hi, when I try to push to the db I get an error - Can't reach database server..., can you help?

    • @ChrisBlakely
      @ChrisBlakely  9 месяцев назад

      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

  • @laibatariq-tc2yq
    @laibatariq-tc2yq 6 месяцев назад

    Hey! elephantsql is shutting down what should i do now?

  • @kitembe
    @kitembe Год назад +1

    Can I free host this? say using netlify?

    • @ChrisBlakely
      @ChrisBlakely  Год назад +2

      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

  • @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

  • @lokeshnegi5051
    @lokeshnegi5051 10 месяцев назад

    will this project be responsive ?

  • @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  Год назад +1

      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  Год назад +1

      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 Год назад +1

      @@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 5 месяцев назад

    👏👏👏

  • @deepsamanta6112
    @deepsamanta6112 10 месяцев назад

    How to resolve error 404 while executing till the part explained in 1:09:00

    • @MishEsser
      @MishEsser 8 месяцев назад

      I have the same error as well.

    • @MishEsser
      @MishEsser 8 месяцев назад

      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;

  • @MuhammadRidwan-kq4yw
    @MuhammadRidwan-kq4yw 7 месяцев назад

    ts i wish you just use js for it :(

  • @dalestewart
    @dalestewart 7 месяцев назад +4

    elephant.sql will be discontinued by 2025

  • @kensei1412
    @kensei1412 Год назад +1

    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  Год назад +1

      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  Год назад +1

      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!