Basically I want to configure Edge Micro to dispense a token, directly. In that special case it would not proxy to a remote service, but instead would respond directly.
In other words, I'd have an app send a request like this:
POST https://edge-micro-location/token -d 'payload-goes-here'
... and Edge micro would receive that and do... something... then respond with a token. Is it possible to build a plugin that does this? If so, how?
Solved! Go to Solution.
Hi Dino,
Yes, you should be able to simply write a plugin that has middleware that writes to the response object as appropriate (and doesn't call next()). In other words, something like this:
var middleware = function (req, res, next) { // if not token request, skip if (!tokenRequest) return next() // if token request... res.statusCode = 200 res.end("my response") }
Hope that helps!
Scott
Hi Dino,
Yes, you should be able to simply write a plugin that has middleware that writes to the response object as appropriate (and doesn't call next()). In other words, something like this:
var middleware = function (req, res, next) { // if not token request, skip if (!tokenRequest) return next() // if token request... res.statusCode = 200 res.end("my response") }
Hope that helps!
Scott
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |