-
-
Save tmpvar/638794 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http = require 'http' | |
flow = require('../lib/conductor').conductor() | |
#nodes | |
flow.build('port', () -> 8000) | |
('listener', (port, request, response) -> | |
server= http.createServer (req, res) -> | |
request(req) if request | |
response(res) if response | |
server.listen port) | |
('handler', (request) -> 'hello world!\n') | |
('responder', (body, response) -> | |
response.writeHead 200, {'Content-Type': 'text/plain'} | |
response.end body) | |
#connect | |
flow.listener.args.port = flow.port.output | |
flow.handler.args.request = flow.listener.args.request | |
flow.responder.args.body = flow.handler.output | |
flow.responder.args.response = flow.listener.args.response | |
#execute | |
flow.execute() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment