Boss Machine is an API designed to manage the minions, brilliant million-dollar ideas, and meetings for the world's most accomplished (and evil) entrepreneurs. This project involves building out an Express server that will handle various routes and functionality, allowing you to fully manage these resources.
Boss Machine provides a RESTful API that allows you to manage minions, ideas, and meetings. The project is designed to demonstrate proficiency in Express.js, middleware, and handling RESTful routes. The backend is powered by a simple in-memory database.
-
Clone the repository:
git clone https://github.com/elhadjx/boss-machine.git cd boss-machine
-
Install dependencies:
npm install
-
Start the server:
npm run start
The server will be running on
http://localhost:4001
. You can access the frontend by opening theindex.html
file in your web browser. -
Run the tests:
npm run test
This will run the provided test suite, which checks for functionality and edge cases.
-
GET
/api/minions
- Retrieves an array of all minions.
-
POST
/api/minions
- Creates a new minion and saves it to the database.
-
GET
/api/minions/:minionId
- Retrieves a single minion by ID.
-
PUT
/api/minions/:minionId
- Updates a single minion by ID.
-
DELETE
/api/minions/:minionId
- Deletes a single minion by ID.
-
GET
/api/ideas
- Retrieves an array of all ideas.
-
POST
/api/ideas
- Creates a new idea and saves it to the database.
-
GET
/api/ideas/:ideaId
- Retrieves a single idea by ID.
-
PUT
/api/ideas/:ideaId
- Updates a single idea by ID.
-
DELETE
/api/ideas/:ideaId
- Deletes a single idea by ID.
-
GET
/api/meetings
- Retrieves an array of all meetings.
-
POST
/api/meetings
- Creates a new meeting. No request body is needed, as meetings are generated automatically.
-
DELETE
/api/meetings
- Deletes all meetings from the database.
-
GET
/api/minions/:minionId/work
- Retrieves an array of all work for the specified minion.
-
POST
/api/minions/:minionId/work
- Creates a new work object and saves it to the database.
-
PUT
/api/minions/:minionId/work/:workId
- Updates a single work object by ID.
-
DELETE
/api/minions/:minionId/work/:workId
- Deletes a single work object by ID.
This custom middleware ensures that any new or updated ideas are worth at least one million dollars. The total value of an idea is calculated as the product of its numWeeks
and weeklyRevenue
properties.
- File:
server/checkMillionDollarIdea.js
- Usage: Automatically used in the
/api/ideas
routes to validate idea submissions.
The project includes a comprehensive test suite that checks for all essential functionality and edge cases. Tests automatically rerun whenever you save changes to the server files while they are open in a terminal window. To run the tests:
npm run test
- Node.js
- Express.js
- JavaScript
- Mocha & Chai (for testing)