Web Server components for NoFlo
This module provides NoFlo components for running HTTP servers and handling HTTP requests.
webserver/Server— starts an HTTP server per received port, emitting a scoped request/response pair per incoming requestwebserver/BodyParser— parses JSON and urlencoded request bodies intoreq.body(viabody-parser)webserver/Query— parses the request URL's query string intoreq.query(Web-standardURL/URLSearchParams)webserver/WriteHead— writes a status code and headers to the responsewebserver/WriteResponse— writes a string (or stream of strings) to the responsewebserver/SendResponse— ends the response
For practical needs, the higher-level noflo-xpress library is recommended.
Components are discovered automatically by NoFlo 2.x on Node.js. Example in FBP:
WebServer(webserver/Server) LISTENING -> IN WriteHead
8080 -> LISTEN WebServer
WebServer REQUEST -> IN BodyParser OUT -> IN Query OUT -> IN WriteResponse
'Hello world!' -> STRING WriteResponse OUT -> IN SendResponse
Install dependencies and run the test suite:
npm ci
npm test