Skip to content

jpbrab0/graph-questions

Repository files navigation

Graph Questions

About the project 📜

Q&A Api, and can

  • Create Rooms
  • Create questions for a specific room
  • Delete and read questions

And is builded with:

  • Node.js
  • Prisma ORM
  • Graphql
  • Docker-Compose

Installing the project 📦

Prerequisites:

Clone the repository to your local machine:

With Https:

git clone https://github.com/jpbrab0/graph-questions.git

With SSH:

git clone [email protected]:jpbrab0/graph-questions.git

With Github CLI:

gh repo clone jpbrab0/graph-questions

Running the project 🏃

Starting Docker-Compose

  1. Install all dependencies of the project with npm:
  • npm i
  1. Setting up the database:
  • docker-compose up -d

    docker-compose start

  1. Rename the .exemple.env to .env
  • mv .exemple.env .env
  1. Running migrations:
  • npx prisma reset
  1. Initialize the server:
  • npm start

Graphql calls

Url: http://localhost:4000

Get Room By Id

query GET_ROOM($id: ID!) {
    getRoomInfo(id: $id){
        id
        name
        password
        questions {
            id
            question
            read
        }
    }
}
Parameter Type
id ID!

Create Room

mutation CREATE_ROOM($name: String!, $password: String) {
    createRoom(data: {name: $name, password: $password})
}
Parameter Type
name String!
password String

Delete room

mutation DELETE_ROOM($id: ID!) {
    deleteRoom(id: $id)
}
Parameter Type
id ID!

Create Question

mutation CREATE_QUESTION($question: String!, $roomId: ID!) {
  createQuestion(question: $question, roomId: $roomId)
}
Parameter Type
question String!
roomId ID!

Read Question

mutation READ_QUESTION($id: ID!) {
  readQuestion(id: $id)
}
Parameter Type
id ID!

Delete Question

mutation DELETE_QUESTION($id: ID!) {
  deleteQuestion(id: $id)
}
Parameter Type
id ID!

Api Workflow

graph LR;
			A[Room Creation]
			B{Have questions?}
			C[List questions]
			D[Create question]
			E[Read question]
			F[Delete question]
      A-->B;
      B-->|Yes| C;
			B-->|No| D;
			D--> B;
			C-->E;
			C-->F;
Loading

Made by jpbrab0

About

Q&A Graphql api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •