- create the files
env.development
for local &.env.production
for production
PORT=<PORT-NUMBER>
DB_URL=<MONGODB_URL>
SENDGRID_API_KEY=<SENDGRID_API_KEY>
JWT_SECRET=<JWT_SECRET>
SMTP_FROM_EMAIL=<SMTP_FROM_EMAIL>
GRAPHQl API's -
- Register (Create User)
mutation {
register (input: {
email: "[email protected]",
password: "techyaura"
}) {
hashToken
ok
}
}
- Register Verification(Verify User)
mutation {
emailVerificationByOtp(input: { otp: "<OTP>", hashToken: "<hashToken>" }){
message
}
}
- Login (with registered User)
query {
login(
input: {
email: "[email protected]",
password: "techyaura"
}){
message
token
user {
email
id
}
}
}
- TODOS (create) - Authenticated Request(Must sent Authorization HEADER - format:
Authorization: Bearer <Token>
)
mutation {
addTodo (input: { title: "Hello World" }) {
message
ok
}
}
- TODOS (read) - Authenticated Request(Must sent Authorization HEADER - format:
Authorization: Bearer <Token>
)
query {
todoList (first:5, offset: 1, sort: {createdAt: ASC }, filter: {title_contains: "techyaura"}) {
totalCount,
data {
createdAt
title
isCompleted
user {
email
}
}
}
}
- TODOS (View) - Authenticated Request(Must sent Authorization HEADER - format:
Authorization: Bearer <Token>
)
query {
todoView(id: "<<TODO-ID>>") {
title
}
}
- TODOS (update) - Authenticated Request(Must sent Authorization HEADER - format:
Authorization: Bearer <Token>
)
mutation {
updateTodo (id: "<<TODO-ID>>", input: { title: "Hello World - 2" }) {
message
ok
}
}
- TODOS (delete) - Authenticated Request(Must sent Authorization HEADER - format:
Authorization: Bearer <Token>
)
mutation {
deleteTodo(id: "<TODO-ID>") {
message
ok
}
}