We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
login_required
There is no concept of decorator in nodejs. We might need to invent it, which might be complicated.
On the other hand, login_required function can be used without decorator. It can be defined in urls.py wrapping the view.
urls.py
The text was updated successfully, but these errors were encountered:
this is what I did for the view.js:
function authRequired(f) { return function (req, res) { if (!req.owner || !req.user) { res.writeHead(401, { 'Cache-Control': 'no-cache', 'Content-Type': 'application/json' }); res.write(JSON.stringify({error: 'Auth required.'})); res.end(); return; } return f.apply(null, arguments); } }
module.exports = { http307: {post: post, get: get, put: post}, servemedia: {get: authRequired(serveMedia)}, signrequest: {get: authRequired(signrequest), post: authRequired(signrequest)}, postcompleted: {post: redirectedPost, get: authRequired(redirectedGet)} };
Sorry, something went wrong.
Cool, I like it. Easy enough to port it into dingo. @ulion, thanks for the head up.
No branches or pull requests
There is no concept of decorator in nodejs. We might need to invent it, which might be complicated.
On the other hand,
login_required
function can be used without decorator. It can be defined inurls.py
wrapping the view.The text was updated successfully, but these errors were encountered: