Creating the schema
In this section, we will begin by creating a schema.graphql
file in the project root, where we will define the structure of our system. Our first step will be to focus on user registration and login. Once users are registered, they will be able to contribute to our system by adding questions and answers. To ensure security, we will implement a simple username-password authentication system, storing the authentication data in our database.
Additionally, we will utilize the pipes mechanism to assign ownership of questions and answers to individual users. This approach will provide a seamless experience for both users and administrators.
Authentication and authorization
Before we design our login and register resolvers, we will create interfaces and a User
type, responsible for the ownership of questions and answers. It should look like this:
interface StringId{ _id: String! } interface Dated{ createdAt: String! updatedAt...