aichbauer / express-routes-mapper

a small mapper for express routes
MIT License
21 stars 16 forks source link

Feat(Middleware): Add Middleware Functionality #30

Closed toksdotdev closed 5 years ago

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.6%) to 89.583% when pulling 4aa09bb2ef542d062bf39007db4be3831e2f7707 on TNkemdilim:integrate-middleware into 2a61ffdf608823390e604634fa45802b63ae7360 on aichbauer:master.

aichbauer commented 5 years ago

We should also test it with import in test/src/index.js

toksdotdev commented 5 years ago

Ok, I'll work on the changes.

toksdotdev commented 5 years ago

Just adjusted the PR based on the previous reviews (testing with imports included).

Also contained is @joneldiablo PR to allow grouped middlewares on a route path.

const groupedMiddleware1 = (req, res, next) => {
  next();
};

const router = mapRoutes(routes, 'test/fixtures/controllers/', [groupedMiddleware1]);
aichbauer commented 5 years ago

@TNkemdilim right now it is also possible to pass a function as third argument like:

const router = mapRoutes(routes, 'test/fixtures/controllers/', middlewareGeneral);

If we support this, we should also have a test case for this case...

aichbauer commented 5 years ago

@TNkemdilim any updates for this test case? If we write that last test i am happy to merge this PR. Also thank you for taking the time and contribute to this project, i really appreciate your effort 👍

toksdotdev commented 5 years ago

I'll send in the updates shortly.

toksdotdev commented 5 years ago

Done!!! Fixes #20 🚀🚀🚀