Skip to content

techyaura/instatodos-server

Repository files navigation

How to configure for use!

  • 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 -

  1. Register (Create User)
    mutation {
		register (input: {
			email: "[email protected]",
			password: "techyaura"
		}) {
			hashToken
			ok
		}
	}
  1. Register Verification(Verify User)
    mutation {
    	  emailVerificationByOtp(input: { otp: "<OTP>", hashToken: "<hashToken>" }){
    	    message
    	  }
    }
  1. Login (with registered User)
    query {
	  login(
		  input: {
			email: "[email protected]", 
	  		password: "techyaura"
		  }){
	    message
	    token
	    user {
	      email
	      id
	    }
	  }
	}
  1. TODOS (create) - Authenticated Request(Must sent Authorization HEADER - format: Authorization: Bearer <Token>)
    mutation {
	  addTodo (input: { title: "Hello World" }) {
	    message
    	ok
	  }
	}
  1. 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
				}
			}
		}
	}
  1. TODOS (View) - Authenticated Request(Must sent Authorization HEADER - format: Authorization: Bearer <Token>)
    query {
	  todoView(id: "<<TODO-ID>>") {
	    title
	  }
	}
  1. TODOS (update) - Authenticated Request(Must sent Authorization HEADER - format: Authorization: Bearer <Token>)
    mutation {
	  updateTodo (id: "<<TODO-ID>>", input: { title: "Hello World - 2" }) {
	    message
    	ok
	  }
	}
  1. TODOS (delete) - Authenticated Request(Must sent Authorization HEADER - format: Authorization: Bearer <Token>)
    mutation {
	  deleteTodo(id: "<TODO-ID>") {
	    message
    	ok
	  }
	}