Git Product home page Git Product logo

Comments (3)

manast avatar manast commented on June 9, 2024

nice to hear you liked it. It still lacks quite a lot of functionality but I will be keep adding it since I need a complete ACL system in my solution.

Regarding the error handler. I tried to follow the express convention for handling errors, cant you achieve what you want by implementing the redirection in the app.error route?
If that doesn't work, do you have any other solution in mind?

from node_acl.

c0d3x42 avatar c0d3x42 commented on June 9, 2024

I'll have to look into app.error, as i'm not aware of what it does/how it works.
i'm trying to get node_acl working alongside railwayjs / express-on-railway, so i'm not sure if i've got access to app.error.

One option i thought about was passing a hash of options to the constructor which'd specify callbacks to be run in the event of auth failure. i.e. redirect to a /login url.

from node_acl.

manast avatar manast commented on June 9, 2024

My app.error looks like this (which is enough for a simple REST api)

app.error(function(err, req, res, next){
  if(!err.errorCode){
    err.errorCode = 500
  }

  var msg = err.msg
  if(!msg){
    msg = err
  }

  res.statusCode = err.errorCode

  res.send(msg)
});

from node_acl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.