This is Node.js with GraphQL and Appolo Server, it uses Postgres Databse with Sequilizer (ORM) to store Users and Messages informations. The server accepts Query and Mutaion from React Apollo client
- User Signup
- User login
- Create message
- Delete message
- doc/playground_screenshots/signIn.png
- doc/playground_screenshots/create_message.png
- doc/playground_screenshots/list_users.png
- Create ApolloServer listen to http://localhost:8000/graphql')
- Create context object with authenticate token, models, ...
- Create a few users
- Create messages belong to users
- define query for find users
- define mutation to create users
- define query for find messages
- define mutation to create message
- define mutation to delete message
Check role for "ADMIN" or "USER"
Use Sequlize (ORM) to communicate with Postgres database
- use models.UserfindByIPk(id) to find user with id
- use models.UserfindAll() for all users
- signUp: username, email, password
- signIn: username and password
Define user schema in Postgres database
username, email, password, role User.hasMany messages
text, userId Message.belongsTo Use
Uses to preload users into local cache to reduce number of requests to database