This is a recipes CRUD backend.
View live demo here
- NodeJs
- GraphQl
- Typescript
- Express
- Apollo
- TypeOrm
- Bcrypt
- JsonWebToken
- PostgreSQL
- Clone the repository or download the zip file
$ git clone [email protected]:Mscebba/graphql_puzzle.git
- Install dependencies with npm
$ npm install
or using yarn
$ yarn
Rename .env.example to .env
PORT= '...your port (without quotes)'
JWT_SECRET_KEY= '....your jwt secret key (without quotes)'
DB_TYPE=
DB_USERNAME =
DB_PASSWORD=
HOST=
DB_NAME=
- Start PostresQl server and create the database with the name in "database".
- From the folder you cloned the repository run the application.
Using npm
$ npm start
or using yarn
$ yarn start
- Open a browser and go to the Apollo GraphQL Playground
http://localhost:4001/graphql
- Create your user first with the signUp mutation
mutation signUp {
signUp(input: { name: "name", email: "email", password: "password" }) {
id
email
name
createdAt
}
}
- Then login to get the token and run the other queries
mutation login {
login(email: "email", password: "password") {
token
}
}
{
"data": {
"login": {
"token": "eyJhbGciOiJIUzI1NiI....."
}
}
}
- Copy the token and paste it below in the header after Bearer
{
"authorization": "Bearer eyJhbGciOiJIUzI1NiI....."
}
- You'll find the other queries in the Playground right tabs DOCS and SCHEMA
- For more documentation about "Apollo GraphQL Playground" go here
https://puzzlegraphql.herokuapp.com/graphql
Martin Scebba | October 2020