See the code on github
This project implements a full stack graphQl version of a ToDo app. The project has an api and a client layer. The backend is using react.js, sequelize.js, express and appollo server. The GraphQl layer is served by a Mysql database.
Be warned this is full stack project and you will need to be comfortable with the above mentioned technologies to install and run this.
See the full code on github
- To Do App GraphQL folder structure
- index.js (This starts the express server, I have also combined the models and resolvers here too, in real app this will be seperated out)
- sequelize.js (This file contains the database settings for mysql plus some sql commands to setup tables with inital data)
- example-queries.js (This file is for reference only. It has some sample graphql queries that you can use to test)
- item.js (Contains the model for to do item)
- index.js(The entire client app is in this file)
…a bit about the api code
To install api app
You need a working mysql db server with the following setup : db name : to_do , username: testuser password : test
(data base settings are found in sequelize.js)
Once you have a myslq database setup and running with the above details you can run following from the api directory :
If the install was successful then you should get the following screen in the terminal window. You will notice that it is running some mysql commands to create tables and entries. If you get red messages then you probably have some database setup issue.
The api app will run on port 3000. Once the server is running you can open the link http://localhost:3000/graphql in you browser and test the graphql queries as shown below :
To install the client app
change directory to client directory and run following :
The app will run on port 3001. You can open the app in the browser using link http://localhost:3001/ (Note: the api needs to be running to use the app).