tetsFlow

Hello

[{"id":"3f239318.c313cc","type":"http in","z":"dba3911.67246f","name":"signin request","url":"/signin","method":"get","swaggerDoc":"","x":92,"y":150,"wires":[["6a51c9b0.9fce5"]]},{"id":"6a51c9b0.9fce5","type":"function","z":"dba3911.67246f","name":"search query","func":"context.global.emailId = msg.req.query.email;\nmsg.emailId = context.global.emailId;\ncontext.global.password = msg.req.query.password;\nmsg.password = context.global.password;\n\nmsg.payload = \"userSearch:\"+msg.req.query.email;\n\n//msg.payload = \"userSearch:\"+msg.req.query.email+\" AND \"+\"passwordSearch:\"+msg.req.query.password;\n\nreturn msg;","outputs":1,"noerr":0,"x":269,"y":149,"wires":[["24ec4a91.8338e6","952f49e1.8f48c8"]]},{"id":"24ec4a91.8338e6","type":"cloudant in","z":"dba3911.67246f","service":"rbs-service-cloudantNoSQLDB Dedicated","cloudant":"","name":"search user","database":"authcredentials","search":"_idx_","design":"userSearch","index":"userSearch","x":281,"y":227,"wires":[["3151b683.486a2a","86ed1546.d3f56"]]},{"id":"ecf75a4b.d20ee","type":"http response","z":"dba3911.67246f","name":"auth response","x":713,"y":408,"wires":[]},{"id":"952f49e1.8f48c8","type":"debug","z":"dba3911.67246f","name":"","active":true,"console":"false","complete":"payload","x":510,"y":62,"wires":[]},{"id":"3f890f79.24abf","type":"debug","z":"dba3911.67246f","name":"","active":true,"console":"false","complete":"payload","x":672,"y":290,"wires":[]},{"id":"3151b683.486a2a","type":"function","z":"dba3911.67246f","name":"response message","func":"\nif (msg.payload.length > 0 && msg.payload[0].password == msg.password ) {\n        msg.payload = \"Success\";\n        msg.statusCode = 200;        \n} else {\n    msg.payload = \"Unauthorized\";\n    msg.statusCode = 401;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":280,"y":307,"wires":[["3f890f79.24abf","ecf75a4b.d20ee"]]},{"id":"86ed1546.d3f56","type":"debug","z":"dba3911.67246f","name":"","active":true,"console":"false","complete":"payload","x":595,"y":193,"wires":[]}]
josephchackoks

Flow Info

created 1 year, 6 months ago

Node Types

Core
  • debug (x3)
  • function (x2)
  • http in (x1)
  • http response (x1)
Other

Tags

Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option