Uses the following packages:
- go.mongodb.org/mongo-driver/mongo - MongoDB Driver API
- github.com/graphql-go/graphql - GraphQL
- github.com/dgrijalva/jwt-go - JSON Web Tokens (JWT)
- golang.org/x/crypto/bcrypt - Package bcrypt
- Authorization Header
- SignUp/SignIn users
- Users Profiles
- List recipes
- Recipe pages
- Add/Edit/Delete recipes
- Like/Unlike recipes
var config = configModel{
	mongoUri:    "mongodb://admin:admin@localhost:37812/react-recipes", 		   // Mongo Uri 
	mongoDb:     "react-recipes",                                                  // DB name
	tokenSecret: "secret",                                                         // Secret to use in Tokens
	tokenExp:    "1h",                                                             // Expiration of Token
	serveUri:    ":4444",                                                          // Serve
}
| key | type | 
|---|---|
| _id | ID | 
| name | string | 
| imageUrl | string | 
| category | string | 
| description | string | 
| instructions | string | 
| createdDate | unixtime | 
| likes | int | 
| username | string | 
| key | type | 
|---|---|
| _id | ID | 
| username | string | 
| password | string | 
| string | |
| joinDate | unixtime | 
| favorites | array[Recipe] | 
{
  getAllRecipes {
    ...MinimalRecipe
  }
}
fragment MinimalRecipe on Recipe {
  _id
  name
  imageUrl
  category
}
query ($searchTerm: String) {
  searchRecipes(searchTerm: $searchTerm) {
    _id
    name
    likes
  }
}
query ($_id: ID!) {
  getRecipe(_id: $_id) {
    ...CompleteRecipe
  }
}
fragment CompleteRecipe on Recipe {
  _id
  name
  imageUrl
  category
  description
  instructions
  createdDate
  likes
  username
}
mutation ($username: String!, $email: String!, $password: String!) {
  signupUser(username: $username, email: $email, password: $password) {
    token
  }
}
mutation ($username: String!, $password: String!) {
  signinUser(username: $username, password: $password) {
    token
  }
}
{
  getCurrentUser {
    username
    joinDate
    email
    favorites {
      _id
      name
    }
  }
}
username not used, obtained by Token Authorization.
mutation ($name: String!, $imageUrl: String!, $category: String!, $description: String!, $instructions: String!, $username: String) {
  addRecipe(name: $name, imageUrl: $imageUrl, category: $category, description: $description, instructions: $instructions, username: $username) {
    ...MinimalRecipe
  }
}
fragment MinimalRecipe on Recipe {
  _id
  name
  imageUrl
  category
}
mutation ($_id: ID!, $name: String!, $imageUrl: String!, $category: String!, $description: String!, $instructions: String!) {
  updateUserRecipe(_id: $_id, name: $name, imageUrl: $imageUrl, category: $category, description: $description, instructions: $instructions) {
    ...CompleteRecipe
  }
}
fragment CompleteRecipe on Recipe {
  _id
  name
  imageUrl
  category
  description
  instructions
  createdDate
  likes
  username
}
query ($username: String!) {
  getUserRecipes(username: $username) {
    ...CompleteRecipe
  }
}
fragment CompleteRecipe on Recipe {
  _id
  name
  imageUrl
  category
  description
  instructions
  createdDate
  likes
  username
}
username not used, obtained by Token Authorization.
mutation ($_id: ID!, $username: String!) {
  likeRecipe(_id: $_id, username: $username) {
    ...LikeRecipe
  }
}
fragment LikeRecipe on Recipe {
  _id
  likes
}
username not used, obtained by Token Authorization.
mutation ($_id: ID!, $username: String!) {
  unlikeRecipe(_id: $_id, username: $username) {
    ...LikeRecipe
  }
}
fragment LikeRecipe on Recipe {
  _id
  likes
}
mutation ($_id: ID!) {
  deleteUserRecipe(_id: $_id) {
    _id
  }
}
MIT