allcount / allcountjs

Rapid application development framework for Node.js
http://allcountjs.com
MIT License
402 stars 83 forks source link

Reuse authentication middleware #108

Closed ghost closed 8 years ago

ghost commented 8 years ago

I'm using my own express server as shown in the examples. But I'd like to have other endpoints protected with the same authentication credentials.

Is it possible to reuse the authentication methods as standalone middleware to protect routes external to AllcountJS? Ex: /other/route/protected

paveltiunov commented 8 years ago

Yep. You could use appAccessRouter as in the example below: https://github.com/allcount/allcountjs/blob/master/routes/integrations-route.js https://github.com/allcount/allcountjs/blob/c35e61effdd1f58c215b527f76e5b19201d7db62/allcount-server.js#L66