FACN3 / umm-el-fahem

authentication project
0 stars 0 forks source link

Can destructure the handlers when you import #40

Open matthewdking opened 6 years ago

matthewdking commented 6 years ago

When you import the handlers you can actually destructure the functions. This means you don't have to do this...

handlers.homeHandler(req, res);

But can call the function immediately without repeating handlers.

homeHandler(req, res);

When you import the handlers the code could look something like...

const {
  homeHandler,
  handlerLogin,
  handlerAddUser,
  handlerAddArticle,
  handlerPosts,
  notFoundHandler,
} = require('./handler.js');