A simple graphql server being implemented for learning purpose
The server requires npm and docker/docker-compose to be installed, and it is made using Apollo Server / GraphQL , TypeScript and PostgreSQL
Run docker-compose up
to start the PostgreSQL container
To stop the database, run docker-compose down
First, run npm install
to install the necessary packages
Then, to start the server, run npm start
The hello query can be tested by accessing Apollo Server on the browser at http://localhost:4000/
Input:
{
hello
}
Return:
{
"data": {
"hello": "Hello, world!"
}
}
input:
mutation createUserMutation($data: UserInput){
createUser(data: $data){
id,
name,
email,
birthDate
}
}
variables:
{
"data": {
"name": "Paulo Otavio",
"email": "otavio@paulo.com",
"password": "1234",
"birthDate": "01-01-2001"
}
}
return:
{
"data": {
"createUser": {
"id": 20,
"name": "Paulo Otavio",
"email": "otavio@paulo.com",
"birthDate": "01-01-2001"
}
}
}