Skip to content

Instantly share code, notes, and snippets.

@rapPayne
Created July 30, 2025 15:05
Show Gist options
  • Save rapPayne/ded6928baa3791b76aa4cbdc6f519caf to your computer and use it in GitHub Desktop.
Save rapPayne/ded6928baa3791b76aa4cbdc6f519caf to your computer and use it in GitHub Desktop.
Please build a RESTful node/express server app that ....
- supports authentication with username and password (no need for OAuth)
- Reads/writes from a flat file JSON-formatted database called ‘./database.json’
- The database has these collections: products, users, orders
- Products have id, name, price, category, on_hand, description
- Users have username, street_address, email, password, first, last, and role
- Orders have id, username,order_date, ship_address, and an array of {product_id, quantity, price}
- Has a search for products capability by name or category
- Has a checkout endpoint so the user can check out. It pretends to charge the user’s credit card and adds the placed order to the orders collection.
- The products GET endpoint is open to all
- The products PATCH, POST, and DELETE endpoints are only open to admins.
- The users endpoints are open to admins and the current user. (They can read their own info).
- Users can read their own orders. Admins can fully edit and read all orders.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment