/Back-End

Primary LanguageJavaScriptMIT LicenseMIT

Water My Plants v1.0.0

Backend for ptpt-watermyplants-2
Deployed link is https://damp-ravine-25485.herokuapp.com/

Auth

Logs a User In

Logs a User In. Returns a token.

POST /api/login

Parameters

Name Type Description
username String

Username of the User

password String

Password of the User

Registers a New User

Registers a New User

POST /api/register

Parameters

Name Type Description
username String

The New Users username *Required

password String

The New Users password *Required

phone_number Integer

The New Users phone number

Users

Gets all users

Gets all users

GET /api/users/

Gets user by ID

Gets user by ID

GET /api/users/:id

Deletes user

Delete user by id. Token is required for deletion.

DELETE /api/users/:id

Updates user

Updates user by id

PUT /api/users/:id

Gets users plants

Gets users plants by id

GET /api/users/:id/plants

Plants

Creates a plant

Creates a plant

POST /api/plants

Parameters

Name Type Description
nickname String

Special nickname of plant if wanted

species String

Plant species

h2o_frequency String

How often the plant requires watering

image String

Image link for the plant

user_id Integer

User ID associated to the plant *REQUIRED

Gets plant by id

Gets specific plant

GET /api/plants/:id

Update plant

Updates a plant

PUT /api/plants/:id

Get users plants

Does the same thing as in users. Gets users plants by ID

GET /api/plants/:id/plants

Delete plant by id

Deletes specific plant

DELETE /api/plants/:id