Django like middleware for Zope - wsgi

Is there something similar to Django Middleware in Zope? What I want is, to check and validate all the request coming to Zope server to put some constraints on them and show the response accordingly.
I have done this previously in Django using Middleware, so was hoping to get something similar for Zope as well, but could not find it.
Please suggest.

You can use zope.schema based libraries like formlib or z3c.form to model forms.
Widget/form generation and validation is basically kind of build-in and can be customized as needed.

No, Zope 2 does not support WSGI middleware, at least, not out of the box.
You could try and see if repoze.zope2 works for your use-case, as that bolts a WSGI pipeline on top of Zope 2. Note that development for that package stopped in 2009, and the last released version only supports Zope 2.10. YMMV.
I suspect that your use-cases may be satisfied in other ways though, but you don't provide enough detail for us to help you.

Related

node-quickbooks vs intuit-oauth

I am doing research on quickbooks online integration using node and angular 8.
The official intuit developer site provides two node packages.
one is official from intuit and one is from community.
I have glanced through both of them.
the official package is fairly universal. It essentially is just a API client to send a request to remote server and the payload is basic json format.
the community package seems a bit more specific but the documentation seems a bit confusing.
Which one would you choose to do the work and why?
I would love to hear your input.
Thanks :)
The Intuit provided library (intuit-oauth) is specifically for authenticating and getting the OAuth token you need to communicate with the Quickbooks API, the other library (node-quickbooks) is for making the actual calls against the API endpoints.
You will need both libraries, unless you are handling authentication in a different way.
Fwiw for whoever finds this useful:
I forked intuit-oauth, added typescript and fixed vulnerabilities that have been fixed in the PRs of their repo for years and never updated here: https://www.npmjs.com/package/intuit-oauth-ts
Additionally I forked node-quickbooks, updated the api to return promises rather than relying on callbacks, resolved the discovery URLs automatically, changed the format of response objects to be more sensible, and added (unfortunately only some) of the typescript definitions for it here: https://www.npmjs.com/package/qbo. I don't have enough time to add the definitions for all of the files (largey because the included ones should be completely exhaustive for every property in the QBO api, which is timeconsuming to define). If someone would like to contribute by adding more of the typescript definitions or adding all of them, I would really appreciate it.
I am interested in any example angular app using intuit-oauth
Trying to work it out but getting issues since there is no document for typescript.

What is the benefit of using node.js http-errors package?

In multiple tutorials I saw people using http-errors npm package. Based on its docs, it provides only a handful of functions. I do not understand its popularity and use-case.
Why not simply use
return res.status(errorCode).render(errorTemplate)
?
Does this package provide something useful, or is it literally just a custom one-function middleware? Its weekly downloads are astronomical.
Strange question...
It should be a comment but write here du to the length...
First the download rate is due to the fact that it's a part of popular node.js frameworks... A visit on the github page will explain this :
Create HTTP errors for Express, Koa, Connect, etc. with ease.
For the use case, just a visit inside the code shows what it does :
Set and fill specific errors
Fill the res with this errors
Nothing surprising, but it does well the job, and it's not usefull to reinvent the wheel...
https://github.com/jshttp/http-errors/blob/master/index.js

Creating modules/HMVC in sails.js

I am trying to make a separation in my new SailsJS app by creating modules/HMVC, just like ASP.NET MVC, and Codeigniter PHP. These frameworks provide a mechanism for handling such a separation. Do any one have an idea how to implement this in SailsJS?
There is some development taking place in that direction, I'm not quite sure whether or not anything usable already exists, at least I haven't been able to find anything final so far. Two threads where adding HMVC to sails was discussed are
https://github.com/balderdashy/sails/issues/1191
https://github.com/balderdashy/sails/issues/594
I think the most recent sails plugin/backend components system discussion is balderdashy/sails/pull/2083.
It looks like the most viable module solution today is balderdashy/sails-hook-subapps, an example of a sails hook. Hopefully, it works with 0.12.x and gets some attention/docs soon!
Additionally, the project sailorjs/sailorjs appears to do exactly this as a fork of sails from version 0.10.x, though I don't know if there are plans ot utilize that work in sails.js.

Node.js and ACL

I've chosen for my project Node.js+Express+Mongoose. Until now, I didn´t need to use ACL, but in this phase of project a I need to implement this.
NPM contains a few modules, but which one to choose?
Please tell me your experiences with ACL (Node.js+Express+Mongoose).
And If you know any tutorial it would be great :), but it's not so needed, what I exactly need to know what Node.js programmers are using for ACL.
Last possibility is write own acl-middleware, it could be interesting experience for me. I suppose :)
https://npmjs.org/package/acl
The most used ACL module. It has Express middleware for protect resources and mongo support too..
Update 9.2020:
the acl package has not been updated in 2 years
there is a fork with recent changes: https://github.com/flash-oss/node_acl
acl package has not been updated for the last 2 years. I’m the author of CASL - isomorphic permission management for JavaScript - https://github.com/stalniy/casl
According to npm trends it’s the mostly used library nowadays - https://www.npmtrends.com/acl-vs-#casl/ability
By the way it makes an integration with MongoDB and mongoose really easy!

VJET With NodeJS Modules

I have just imported a NodeJS project into Eclipse with VJET plugin. It seems nice that it understands some of the NodeJS but I don't like that it doesn't recognize Node-MySQL. Is there any documentation on how to write a project (like NodejsTL) to fill up that missing functionality? I could analyze NodejsTL one but if there is any documentation and tutorial - I wouldn't have to.
Yes there is some documentation on this topic of creating type libraries.
http://www.ebayopensource.org/wiki/display/VJET/VJET+Type+lib+Tutorial+-+part+1
There is some work being proposed to help with this and we are currently looking for help to extend VJET to do this work. Here are the tickets related to this request.
https://www.ebayopensource.org/jira/browse/VJET-87
https://www.ebayopensource.org/jira/browse/VJET-88

Resources