Deployed Backend: https://build-week-how-to.herokuapp.com/
How-Tos is a full-stack web application that was built during a "build week" by Lambda School students. Each student fulfills a role in the project to collectively build the application.
How-Tos gives users a site where they can add and edit their own how-tos and everyone else who is signed up can see.
- Node.js - JavaScript runtime for executing JavaScript at the server outside the browser
- Express.js - Lightweight web framework to bootstrap Node.js APIs
- SQLite - Super lightweight database to bootstrap development environments
- PostgreSQL - An advanced object-relational database for production environments
- Knex.js - A SQL query builder that helps abstracting migrations and DDLs for different database types into a single coherent structure
- Knex-Cleaner - Helper library to clean a PostgreSQL, MySQL or SQLite3 database tables using Knex
- Bcrypt.js - A module to help make passwords more secure
- CORS - A Node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options
- Helmet - A collection of 14 smaller middleware functions that set HTTP response headers
- JWT - JSON Web Token for authorization and client side tokens for security
- Supertest - A test module for HTTP assertions
- Jest - A simple JavaScript testing framework
- Dotenv - a zero-dependency module that loads environment variables from a .env file into process.env
Endpoint | Request Type | Request | Response |
---|---|---|---|
/api/auth/register | POST | {username: "", password: "", email: "", usertype: int} | {welcome: username, password: encrypted string} |
/api/auth/login | POST | {username: "", password: ""} | {userobject, token} |
/api/auth/register
POST
-
JWT protected (header) ❌
-
payload (body) ✔️
{ username: "dannybb"; password: "nestor12!"; email: "[email protected]"; usertype: "Content Creator"; }
/api/auth/login POST
-
JWT protected (header) ❌
-
payload (body) ✔️
{ username: "dannybb"; password: "nestor12!"; }
Endpoint | Request Type | Request | Response |
---|---|---|---|
/api/howtos | GET | requires a token | [{howtos}] |
/api/howtos/:id | GET | requires a token | {instruction: string, number: int} |
/api/howtos | POST | {name: "", desc: "", user_id: int} | no return at the moment |
/api/howtos/:id | PUT | {name: "", desc: "", user_id: int} | no return at the moment |
/api/howtos/:id | DELETE | {} | no return at the moment |
/api/howtos GET
-
JWT protected (header) ✔️
-
payload (body) ❌
{ Headers{ Authorization: token}; }
/api/howtos/:id GET
-
JWT protected (header) ✔️
-
payload (body) ❌
{ Headers{ Authorization: token}; }
/api/howtos POST
-
JWT protected (header) ✔️
-
payload (body) ✔️
{ name: "howto howto" desc: "this will show you howto howto" user_id: 3 Headers{ Authorization: token}; }
/api/howtos/:id PUT
-
JWT protected (header) ✔️
-
payload (body) ✔️
{ name: "howto howto" desc: "this will show you howto howto" user_id: 3 Headers{ Authorization: token}; }
/api/howtos/:id DELETE
-
JWT protected (header) ✔️
-
payload (body) ❌
{ Headers{ Authorization: token}; }
Endpoint | Request Type | Request | Response |
---|---|---|---|
/api/howtos/:id/steps | GET | requires a token | [{number: int}, {intruction: string}] |
/api/howtos/:id/steps/:number | GET | requires a token | {instruction: string} |
/api/howtos/:id/steps | POST | {number: int, instruction: string} | no return at the moment |
/api/howtos/:id/steps/:number | PUT | {number: int, instruction: string} | no return at the moment |
/api/howtos/:id/steps/:number | DELETE | {} | no return at the moment |
/api/howtos/:id/steps GET
-
JWT protected (header) ✔️
-
payload (body) ❌
{ Headers{ Authorization: token}; }
/api/howtos/:id/steps/number GET
-
JWT protected (header) ✔️
-
payload (body) ❌
{ Headers{ Authorization: token}; }
/api/howtos/:id/steps POST
-
JWT protected (header) ✔️
-
payload (body) ✔️
{ number: 1 instruction: "read this document" user_id: 3 Headers{ Authorization: token}; }
/api/howtos/:id/steps/:number PUT
-
JWT protected (header) ✔️
-
payload (body) ✔️
{ name: 1 desc: "read the readme available at: " user_id: 3 Headers{ Authorization: token}; }
/api/howtos/:id/steps/:number DELETE
-
JWT protected (header) ✔️
-
payload (body) ❌
{ Headers{ Authorization: token}; }
Endpoint | Request Type | Request | Response |
---|---|---|---|
/api/howotos/:id/likes | GET | requires a token | returns likes for a howto |
/api/howotos/:id/likes/users | GET | requires a token | returns all a users likes |
/api/howotos/likes | GET | requires a token | returns all likes |
/api/howotos/:id/likes | POST | {user_id, howto_id} | no return at the moment |
/api/howotos/:id/likes | DELETE | {user_id, howto_id} | no return at the moment |
/api/howtos/:id/likes GET
-
JWT protected (header) ✔️
-
payload (body) ❌
{ Headers{ Authorization: token}; }
/api/howtos/:id/likes/users GET
-
JWT protected (header) ✔️
-
payload (body) ❌
{ Headers{ Authorization: token}; }
/api/howtos/likes GET
-
JWT protected (header) ✔️
-
payload (body) ❌
{ Headers{ Authorization: token}; }
/api/howtos/:id/likes POST
-
JWT protected (header) ✔️
-
payload (body) ✔️
{ howto_id: 1 user_id: 3 Headers{ Authorization: token}; }
/api/howtos/:id/likes PUT
-
JWT protected (header) ✔️
-
payload (body) ✔️
{ howto_id: 1 user_id: 3 Headers{ Authorization: token}; }
/api/howtos/:id/steps/:number DELETE
-
JWT protected (header) ✔️
-
payload (body) ❌
{ Headers{ Authorization: token}; }