Ndao atakalo api with graphql
TechZara Weekly Coding Challenge, week 3.
Clone this repository to your computer
Install all dependancies using npm install
To the project folder, run
Now the database is created
Run this command:
Example of creating an new exchange:
mutation {
addEchange(nom:"Koto",
contact:"03500000000",
nom_kilalao:"papango",
atakalo:"kalesy",
photos:"urlphoto")
{
nom,
contact,
nom_kilalao,
atakalo,
photos
}
}
You can pass many parameters as you want to pass, there are the available parameters:
query{
echanges{
nom,
nom,
contact,
nom_kilalao,
atakalo,
photos
}
}
Depending on the parameters you send, the API returns the desired responses. It shows only the actives exchanges. Example of an response:
{
"data": {
"echanges": [
{
"nom": "Koto",
"contact": "0350000000", // Must be a length of ten
"nom_kilalao": "papango",
"atakalo": "kalesy",
"photos": "urlphoto"
}
]
}
}
To desactivate an exchange, pass the ID of the exchange you want to desactivate as follows:
mutation{
desactivateEchange(id_echange:n){
id_echange
}
}
Replace the n
to the ID you want to pass.