Backend Server for Ecommerce app
- NodeJS / ExpressJS
- GraphQL / Apollo Server
- MongoDB / Mongoose
- JWT authentication
- Sendgrid for sending emails
- more ...
- Email sign up
- Email confirmation
- Email login
- Add to cart
- Create order
- Store / Products / Orders queries
- Profile query
- Forget password (API only)
- Change password (API only)
- Create Store (API only)
- Create Product (API only)
- more ...
query products {
products {
_id
title
imageUrl
storeId
description
}
}
query product {
product(_id: "5fb1298205ddb9f2422951de") {
_id
title
imageUrl
description
store {
_id
name
}
}
}
query stores {
stores {
_id
name
products {
_id
title
}
}
}
query store {
store(_id: "5fb127be071b64f1a9b25002") {
_id
name
products {
_id
title
}
}
}
query me{
me{
_id
isVerified
roles
firstName
lastName
}
}
query myOrders{
myOrders{
_id
user{
firstName
lastName
}
receiver{
name
zipcode
}
productsOrdered{
quantity
product{
_id
title
imageUrl
}
}
}
}
query myOrder{
myOrder(orderId:"5fbfd095c61bace0143912c0"){
_id
productsOrdered{
quantity
product{
title
imageUrl
}
}
}
}
mutation signup {
signup(
input: {
email: "[email protected]"
password: "akrom2"
firstName: "Akrom2"
lastName: "Tester2"
}
) {
success
message
}
}
# mutation to resend confirmation email
mutation resendConfirmation{
resendConfirmation(input:{email:"[email protected]"}){
message
}
}
# user need to confirm email via confirmation email to be able to login
mutation login {
login(input: { email: "[email protected]", password: "akrom" }) {
token
userId
}
}
# Mutation to send 6-digit OTP to an email.
mutation sendResetPasswordOTP{
sendResetPasswordOTP(input:{email:"[email protected]"}){
message
success
userId
}
}
# Mutation to reset user password after recieving OTP
mutation resetPassword{
resetPassword(input:{userId:"5fbb5aafee3fb87c9230d3e9",password: "akromnew", otp: 647609}){
message
success
}
}
mutation createStore {
createStore(
input: {
email: "[email protected]"
password: "example"
name: "Example"
phone: "+8210 5232323232"
address: "Somethere nearby"
}
) {
_id
email
phone
}
}
mutation createProduct {
createProduct(
input: {
storeId: "5fb127be071b64f1a9b25002"
title: "Third Product"
price: 139
imageUrl: "Url 3"
description: "Here goes short description"
}
) {
_id
price
title
storeId
description
}
}
mutation createOrder{
createOrder(input:
{
products: [{productId:"5fb1298205ddb9f2422951de", quantity: 1},{productId:"5fb1299605ddb9f2422951df", quantity: 3}],
receiver:{name:"Random", phone:"03203203", address: "Seoul", zipcode:"32323"}
}){
_id
}
}