Wiring the Users View into the Admin Portal

It’s an application, so we start with our standard application preamble:

 function​ createAdminApplication ({ db, messageStoreDb }) {
 const​ queries = createQueries({ db, messageStoreDb })
 const​ handlers = createHandlers({ queries })
 
 const​ router = express.Router()
 
  router.route(​'/users'​).​get​(handlers.handleUsersIndex)
  router.route(​'/users/:id'​).​get​(handlers.handleShowUser)
 return​ {
  handlers,
  queries,
  router
  }
 }
 
 module.exports = createAdminApplication

Set up the queries, handlers, and router. We’re going to start with two routes. The first is for the master list of users, and the second is for a particular user. ...

Get Practical Microservices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.