TechLabs-Aachen / react-workshop-vercel-nextjs

0 stars 0 forks source link

Graphql playgound #8

Open v4nderstruck opened 1 year ago

v4nderstruck commented 1 year ago

Hi,

if you want to learn how to use grapghql, this project provides a grapqhl backend (sadly in python).

To install dependencies for the backend you will have to install python as well as flask and ariadne.

The backend can be started by going into the directory workshop-food-facts/backend and starting python backend.py (or python3 backend.py). It should start on localhost:5000.

However, the nextJS app has a route rewrite for that. So after starting the backend, you can start the NextJS app npm run dev in the workshop-food-facts/ directory and you should be able to visit localhost:3000/playground (<-- Note: NextJS webserver will do a route rewrite) and view the backend graphql Playground..

One of the first tasks would be to check how grapqhl works. Just look on YT, there are many tutorials. Then write queries in the playground to get some data. You should be able to view the schema (there is a schema button on the right side of the playground). Build some queries and get familiar with grapqhql queries. Let me know if you need help

After you feel comfortable, you can move on integrating it in React. (I will then add instructions)

MSezai commented 1 year ago

To be able to import openfoodfacts, pip install openfoodfacts is also needed :)