Coder Social home page Coder Social logo

backend's Introduction

Endpoints OVERVIEW

Method Endpoint Access Control Description
POST /auth/register none Registers a user & logs them in.
POST /auth/login none Logs the user in and returns a token.

POST '/api/auth/register'


Body

Name Type Required Description Unique
firstname string Y User's first name N
lastname string Y User's first name N
email string Y User's email address Y
username string Y User's prefered username Y
password string N User's password Y

Register Response

{
    "message": "user created successfully",
    "user": 7,
    "username": "rafe",
    "firstname": "rafe",
    "lastname": "rafe",
    "email": "[email protected]",
    "token": "XXXXXXXX"
}

POST '/api/auth/user/login'


Body

Name Type Required Description Unique
username string Y User's username Y
password string Y User's password Y

Response (login)

{
    {
    "message": "Welcome rafe",
    "user": {
        "id": 7,
        "firstname": "rafe",
        "lastname": "rafe",
        "username": "rafe",
        "email": "[email protected]"
    },
    "token": "XXXXXXXXXX"
   }
}

ADD a recipe - POST 'api/recipes'


Body

Name Type Required Description Unique
recipe_image string N Image for the recipe N
title string Y Recipe title N
categories string N Recipe category N
prepTime string N Prep time N
cookTime string N cookTime N
calories string N calories N
servings string N servings N
description string Y cookTime N
ingredients string Y ingredients N
directions string Y directions N
Notes string N Notes N
source string N source N
bio string N bio N
source_image string N link to image N

Response (add recipe)

{
    "message": "recipe created successfully",
    "recipe": 5
}

EDIT a recipe - PUT 'api/recipes/:id'


Body

Name Type Required Description Unique
recipe_image string N Image for the recipe N
title string Y Recipe title N
categories string N Recipe category N
prepTime string N Prep time N
cookTime string N cookTime N
calories string N calories N
servings string N servings N
description string Y cookTime N
ingredients string Y ingredients N
directions string Y directions N
Notes string N Notes N
source string N source N
bio string N bio N
source_image string N link to image N

Response (edit)

{
    "message": "recipe has been updated",
    "data": {
        "id": 5,
        "recipe_image": null,
        "title": "SUSHI STICKS BABY",
        "categories": null,
        "prepTime": null,
        "cookTime": null,
        "calories": null,
        "servings": null,
        "description": "chicken nuggets are not only for kids",
        "ingredients": "chicken breasts, barbecue sauce, breading",
        "directions": "wash the chicken breasts",
        "Notes": null,
        "source": null,
        "bio": null,
        "source_image": null,
        "user_id": 7
    }
}

DELETE a recipe - 'api/recipes/:id'


Body

Name Type Required Description Unique
recipe_image string N Image for the recipe N
title string Y Recipe title N
categories string N Recipe category N
prepTime string N Prep time N
cookTime string N cookTime N
calories string N calories N
servings string N servings N
description string Y cookTime N
ingredients string Y ingredients N
directions string Y directions N
Notes string N Notes N
source string N source N
bio string N bio N
source_image string N link to image N

Response (delete)

{
    "message": "recipe has been deleted",
    "data": 1
}

backend's People

Contributors

agyin3 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.