Problem: Outsourcing our data logging is too expensive. We need to insource it.
Build an API server that accepts...
[x] POST requests to /log with log data to send to a Kafka queue
[x] Log request will include { actionId, [userId], [data] }
[x] Whenever a log is added to Kafka, it is immediately processed and appended to a log file, app.log
[x] POST requests to /classes/user to create a user
[x] User must have { name, email, password }
[x] Log is created with actionId = USER_SIGNUP and data = request.body
[x] PUT requests to /classes/user/:id to update a user
[x] User cannot update email
[x] Log is created with actionId = USER_EDIT_PROFILE, userId = request.body.id, and data = request.body
[x] All other requests must return a 404 Not Found
Technologies
[x] NPM
[x] NodeJS
[x] Koa
[x] Sequelize
[x] Kafka
[x] PostgresSQL
[x] ESLint
[x] MochaJS
[x] ShouldJS
Requirements
[x] All technologies must be used
[x] Project must be pushed to public repository
[x] Setup should be npm install and npm start
Hint: use npm postinstall to install any technologies outside of npm, and npm prestart to start any technologies before starting the web server
[x] Tests should be runnable via npm test
Grading (100 points)
[x] Install (5 points)
[x] Kafka install (2 points)
[x] PostgresSQL install (2 points)
[x] NPM install (1 point)
[x] Endpoints (25 points)
[x] POST /log (10 points)
[x] POST /classes/user (5 points)
[x] PUT /classes/user/:id (5 points)
[x] 404 (5 points)
[x] Tests (20 points)
[x] Unit tests (15 points)
[x] Log (5 points)
[x] User create (5 points)
[x] User update (5 points)
[x] Integration tests (5 points)
[x] Style (50 points)
[x] Readability; naming, flow, one voice, whitespace, alignment (10 points)
Kafka server
Problem: Outsourcing our data logging is too expensive. We need to insource it.