bestbudapp / backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bestBud API Documentation

Deployed here: https://bestbudapp.herokuapp.com/

Sign Up

POST /api/auth/signup

Body:

{
    username: string,
    password: string
}

The username value must be unique for every user.

Upon successful sign up, the user's id and a token is returned.

Sign In

POST /api/auth/signin

Body:

{
    username: string,
    password: string
}

Upon successful sign in, the user's id and a token is returned.

Fetch All Strains

POST /api/strains

Body:

{
    limit: number,
    offset: number
}

There are about 1500 strains, so you don't want to load them all at once.

Example:

{
    limit: 30,
    offset: 60
}

This will return 30 results, skipping the first 60. This is ideal for pagination.

Query Strains

POST /api/strains/query

Body:

{
    filter: string,
    query: string,
    limit: number,
    offset: number
}

You can filter by name, flavors, race, positive_effects, negative_effects, medical_conditions, and rating.

The query for rating is still a string.

Fetch a Single Strain

GET /api/strains/:id
Parameter Type Description
:id string Strain ID

Fetch User's Cabinet

GET /api/cabinet/:id
Parameter Type Description
:id string User ID

Add Strain to User's Cabinet

POST /api/cabinet/:id
Parameter Type Description
:id string User ID

Body:

{
    strain_id: number
}

Delete Strain from User's Cabinet

DELETE /api/cabinet/:id
Parameter Type Description
:id string Cabinet ID

Strain Recommender

POST /api/recommender

Body:

{
    input: string
}

Status Codes

bestBud returns the following status codes in its API:

Status Code Description
200 OK
201 CREATED
400 BAD REQUEST
401 UNAUTHORIZED
404 NOT FOUND
500 INTERNAL SERVER ERROR

About


Languages

Language:JavaScript 100.0%