I was wondering, is it possible to write some middle-ware/modules using Node.JS and then use them with other technologies?
As a useless example (just for demo idea), writing a Node.JS module that handles CORS headers, all it does is add the headers for CORS based on a config (regardless of its origin). And then, deploy this module to use with other technologies, for example use it with PHP, ASP.NET, etc.
The idea I could think of is something like registering modules in IIS (in theory), but I have no idea how to do that (for IIS or other hosting environments).
Is it possible to make such a thing? if so, how would I do it??
Have a cool signature? hit me up and I might use it.
(Aug 18, 2017 11:41 PM)severos Wrote: I was wondering, is it possible to write some middle-ware/modules using Node.JS and then use them with other technologies?
As a useless example (just for demo idea), writing a Node.JS module that handles CORS headers, all it does is add the headers for CORS based on a config (regardless of its origin). And then, deploy this module to use with other technologies, for example use it with PHP, ASP.NET, etc.
The idea I could think of is something like registering modules in IIS (in theory), but I have no idea how to do that (for IIS or other hosting environments).
Is it possible to make such a thing? if so, how would I do it??
Sounds more like just you want to use Node as a micro service or API.
(Aug 19, 2017 12:28 AM)doon Wrote: Sounds more like just you want to use Node as a micro service or API.
Not really in that meaning, far as I understand a micro service is a stand alone, it does all the work to process a request (receive, generate response, send), while I'm looking to manipulate the request, another example would be using node.js to verify session and authentication of a request before passing it to ASP.NET handler, that way the ASP.NET application wouldn't need to do any auth stuff, just focus on its work.
Have a cool signature? hit me up and I might use it.
I can imagine you could do so if you were using it with a REST API, or in some context where the technology involved didn't matter, and all you cared about was an output. Though it's probably easier to implement such a middleware in whatever API you might create, rather than needing a Node module to do so (unless you have a strong reason for doing so.)
For example, you might have a Python application that calls a REST API. But before it does that, you send it to some Node application (as a proxy, relay, cloak, whatever). The Node application can do its thing, and return either the result of the API if the middleware passes, or return an error if the middleware fails.
I know it's possible to make it as a separate API, but then it won't have access to the original request to modify it.
Have a cool signature? hit me up and I might use it.
|