Skip to content

voldev8/recipes-api

Repository files navigation

Flavorites App API

This is the back end part of a simple Recipe MERN App.

Front end part

This is a basic CRUD API. I used express-generator to start with a basic structure, MongoDB Compass for database management,

ENDPOINTS and FIELDS


Recipes

GET '/recipes/'

POST '/recipes/' (auth)

{
  name, ingredients, instructions, tags, image, link;
}

GET '/recipes/:id'

DELETE '/recipes/:id'

PUT '/recipes/:id'

{
  name, ingredients, instructions, tags, image, link;
}

Users

(all auth)

GET '/users/'

GET '/users/fav'

PUT '/users/fav'

PUT '/users/addfav'

{
  recipeId;
}

PUT '/users/removefav'

{
  recipeId;
}

PUT '/users/update'

{
  name, email;
}

PUT '/users/updatepassword'

{
  password, newPassword;
}

Auth

POST '/auth/signup'

{
  name, email, password;
}

POST '/auth/login'

{
  name, password;
}

GET '/auth/logout'

POST '/auth/forgotpassword'

{
  email;
}

PUT '/auth/resetpassword/:resettoken'

{
  password;
}

Tech/framework used

I used express-generator to start with a basic structure, MongoDB Compass for database management,

MongoDB, Express and NodeJs

"@sendgrid/mail": email service,

"bcryptjs": hashing passwords,

"config": for configuration files,

"dotenv": for environment variables,

"express-validator": middleware for easy validate,

"helmet": security,

"html-to-text": for email service,

"jsonwebtoken": jwt,

"mongoose": Mongodb database connection,

"morgan": logger,

"pug": used for email format,

"slugify": slug links (not used)

Installation

Clone

you can download the repo to your computer with the command below

git clone https://github.com/voldev8/recipes-api

Requirements

NodeJs installation

NodeJs

Create an .env file in root folder

Environment Values

MongoDB

MongoDB

MONGO_URI='your mongo uri'

Choose a port

PORT=

Token Settings

JWT_SECRET='secret for hashing'

JWT_COOKIE_EXPIRE=

JWT_EXPIRE=

Sendgrid installation and create an account

SendGrid documentation

SENDGRID_API_KEY=

for the email

FROM_EMAIL=

FROM_NAME=

Setup

now install npm

$ npm install

starting the app

$ npm run start

for nodemon

$ npm run dev

nodemon

Instead of starting the front end and back end separately, concurrently npm can be used More info

License

MIT ©2020 Volkan Uyarer

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published