Take Home API - backend starter package
- Nest JS
- Mongo
- Bcrypt
- JWT
- GraphQL
- Class Validator
$ yarn install
# development watch mode
$ yarn start:dev
# production mode
$ yarn start:prod
SIGNIN - Resolver (GraphQl Query)
# For 1 day login access
query {
signin(
signin: {
email: valid email address thats been registered
password: correct password
isRemembered: 1
}
) {
accessToken
timeout
}
}
# For 1 hour login access
query {
signin(
signin: {
email: valid email address thats been registered
password: correct password
isRemembered: 0
}
) {
accessToken
timeout
}
}
# signin ok response
{
"data": {
"signin": {
"accessToken": one unique generated token containing user email address as payload,
"timeout": access timeout in utc
}
}
}
# signup error response
{
"errors": [
{
"message": any string,
"locations": array of {line: number, column: number},
"path": array of string
"extensions": any error as object
],
"data": any
}
SIGNUP - Resolver (GraphQl Mutation)
# signup request
mutation {
signup(
signup: {
email: valid email address thats never been registered before
password: any password
}
) {
id
email
}
}
# signup ok response
{
"data": {
"signup": {
"id": "61167993150a3881ad5e8e51",
"email": "[email protected]"
}
}
}
# signup error response
{
"errors": [
{
"message": any string,
"locations": array of {line: number, column: number},
"path": array of string
"extensions": any error as object
],
"data": any
}
Nest is MIT licensed.