npm install
This example requires a local MySQL installation.
See .env.example
for credentials, and make sure there are matching credentials in the database and the .env
file.
The .env.dev
file contains variable definitions for the development environment.
The .env.test
file containst variable definitions for the test environment (used on TravisCI, too).
The .env
file is left uncommitted as it is supposed to hold production secrets.
Then, run Nest as usual:
npm run start
or, for development settings:
npm run start:dev
After running
Point your browser at http://localhost:3000/graphql
query {
getCats {
id
name
age
}
}
Where the query
keyword is optional.
mutation CreateCat($data: CreateCatInput) {
createCat(createCatInput: $data) {
name
age
}
}
{
"data": {
"name": "name3",
"age": 5
}
}
subscription catCreated {
catCreated {
name
age
}
}