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
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
Starting Docker-Compose
- Install all dependencies of the project with npm:
npm i
- Setting up the database:
-
docker-compose up -d
docker-compose start
- Rename the .exemple.env to .env
mv .exemple.env .env
- Running migrations:
npx prisma reset
- Initialize the server:
npm start
query GET_ROOM($id: ID!) {
getRoomInfo(id: $id){
id
name
password
questions {
id
question
read
}
}
}
Parameter | Type |
---|---|
id |
ID! |
mutation CREATE_ROOM($name: String!, $password: String) {
createRoom(data: {name: $name, password: $password})
}
Parameter | Type |
---|---|
name |
String! |
password |
String |
mutation DELETE_ROOM($id: ID!) {
deleteRoom(id: $id)
}
Parameter | Type |
---|---|
id |
ID! |
mutation CREATE_QUESTION($question: String!, $roomId: ID!) {
createQuestion(question: $question, roomId: $roomId)
}
Parameter | Type |
---|---|
question |
String! |
roomId |
ID! |
mutation READ_QUESTION($id: ID!) {
readQuestion(id: $id)
}
Parameter | Type |
---|---|
id |
ID! |
mutation DELETE_QUESTION($id: ID!) {
deleteQuestion(id: $id)
}
Parameter | Type |
---|---|
id |
ID! |
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;
Made by jpbrab0