Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 2.33 KB

Lab.md

File metadata and controls

55 lines (37 loc) · 2.33 KB

LAB: Socket.io - Message Queue Server

Before you begin

Refer to Getting Started in lab-instructions.md for complete setup instructions

Getting Started

Get your api server up and running! You're going to be modifying it in this lab.

You will likely be creating 3 new git repositories to house the servers for this lab assignment

Overview

For this lab assignment, we will be writing a Message Queue server that monitors database events, and then modifying our API server to fire events into that Queue on all CRUD operations in our models.

Assignment - Message Queue Server and Logger

  • Create a message queue server
  • Initiate a queue called "files" that monitors "save" and "error" events
  • Initiate a queue called "database" that monitors "create", "read", "update", "delete" and "error" events
  • Create a logger application
  • Connects to the "file" and "database" queues
  • Performs a custom console.log() on the events named above

Assignment 1 - File Writer (warm-up)

This will be a repeat of the previous labs, this time using your new message queue server.

  • In the starter code, you'll once again find an app.js that reads and modifies a file.
  • On a successful write, publish a "save" event to the "file" queue
  • On error, publish an "error" event to the "file" queue
  • Modularize the file reader

Assignment 2 - API Server

Alter your API server to publish events on all CRUD Operations

  • Import the Queue client library
  • Perform a publish into the database queue, after "create", "update", "delete" and on any errors in your models.

Questions

  • Where is the best place to do this? In the mongo.js? In each mongoose model?
  • How will you trap and publish error events?
  • Where will you identify the Queue server?

Testing

  • What will your approach be to asserting the API server published the right event?
  • How will you write assertions on the logger?

Deployment

  • Deploy all 3 servers (server, logger, api server) to Heroku. Use heroku logs to view your logger output as your API is serving requests.
  • Do not deploy the file writer app. Theres' no server running for that

Assignemnt Submission Instructions

Refer to the lab-instructions.md for the complete lab submission process and expectations