To run the development server, use the parallelRun
gradle task.
./gradlew parallelRun
The API and client will run on ports 8080
and 3000
respectively. In addition,
a proxy is configured so requests from the client can be made to the API without
worrying about CORS.
A browser window should automatically open to the application. You can test its functionality by logging in as "customer@example.com" with password "password".
The REST API is secured using JWT. A token can be generated by sending a POST
request to /api/login
.
The following resources have been implemented:
Method | Path | Description |
---|---|---|
POST |
/api/login |
Generates a JWT token |
GET |
/api/products |
Returns a list of products, grouped by category |
GET |
/api/products?category=:name |
Filters the product list by the given category |
GET |
/api/products/:id |
Returns a single product |
POST |
/api/register |
Registers a new customer account |
GET |
/api/users |
Returns a list of all users |
GET |
/api/users/:user |
Returns a single user |
GET |
/api/users/:user/cart |
Returns the items in the user's cart |
POST |
/api/users/:user/cart |
Puts an item into the user's cart |
DELETE |
/api/users/:user/cart |
Deletes all items from the user's cart |
DELETE |
/api/users/:user/cart/:item |
Deletes a single item from the user's cart |
GET |
/api/users/:user/orders |
Returns a list of the user's orders |
POST |
/api/users/:user/orders |
Creates a new order from the items in the user's cart |
GET |
/api/users/:user/orders/:order |
Returns a single user order |