NodeJS/Express/GraphQL API server for Sportacus version 2.
Refer to the INSTALL.md file for installation instructions.
Once the server is running, you can visit http://localhost:27017 (or the hostname and port as specified in your configuration) to access GraphiQL and testing various queries.
Some examples to start with:
Example query to create a new user:
mutation {
signup(userInput:
{
username: "brainy",
firstName: "Brainy",
lastName: "Smurf",
email: "[email protected]",
password: "password"
})
{
_id
email
}
}
Example response (note that the _id
will not match your _id
; they are generated randomly):
{
"data": {
"signup": {
"_id": "607496f93704fd3149b1c1c3",
"email": "[email protected]"
}
}
}
Or ERROR:
{
"errors": [
{
"message": "User exists already!",
"status": 500
}
],
"data": null
}
Example login query:
{
login(emailOrUsername: "[email protected]", password: "password") {
token
userId
}
}
Example result:
{
"data": {
"login": {
"token": "eyJhbGciO...<long string truncated>...rIa2hp8",
"userId": "607496f93704fd3149b1c1c3"
}
}
}
OR error:
{
"errors": [
{
"message": "Password is incorrect.",
"status": 401
}
],
"data": null
}
Example get a list of venues:
query {
getVenues {
items {
_id
name
longName
latitude
longitude
url
poc {
_id
name
email
phone
}
street1
street2
city
state
zipcode
country
parent
children
createdAt
updatedAt
}
total
}
}
Example response:
{
"data": {
"getVenues": {
"items": [
{
"_id": "607cd91c0af32205fa79ed5c",
"name": "Dublin Park",
"longName": "Dublin Park",
"latitude": null,
"longitude": null,
"url": null,
"poc": [],
"street1": null,
"street2": null,
"city": null,
"state": null,
"zipcode": null,
"country": null,
"parent": null,
"children": [],
"createdAt": "2021-04-19T01:13:00.853Z",
"updatedAt": "2021-04-21T03:46:06.966Z"
},
{
"_id": "608322c009689146caf6d1cf",
"name": "Dublin 1",
"longName": "Dublin Park 1",
"latitude": "34.707771",
"longitude": "-86.735505",
"url": null,
"poc": [],
"street1": "8324 Madison Pike",
"street2": null,
"city": "Madison",
"state": "AL",
"zipcode": "35758",
"country": null,
"parent": "607cd91c0af32205fa79ed5c",
"children": [],
"createdAt": "2021-04-23T19:40:48.743Z",
"updatedAt": "2021-04-23T19:40:48.743Z"
}
],
"total": 2
}
}
}