Backend for ptpt-watermyplants-2
Deployed link is https://damp-ravine-25485.herokuapp.com/
Logs a User In. Returns a token.
POST /api/login
Name | Type | Description |
---|---|---|
username | String | Username of the User |
password | String | Password of the User |
Registers a New User
POST /api/register
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 |
Gets all users
GET /api/users/
Gets user by ID
GET /api/users/:id
Delete user by id. Token is required for deletion.
DELETE /api/users/:id
Updates user by id
PUT /api/users/:id
Gets users plants by id
GET /api/users/:id/plants
Creates a plant
POST /api/plants
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 specific plant
GET /api/plants/:id
Updates a plant
PUT /api/plants/:id
Does the same thing as in users. Gets users plants by ID
GET /api/plants/:id/plants
Deletes specific plant
DELETE /api/plants/:id