In server.js, line ~146:
SimpleServer.prototype.listen = function(port,host) {
http.createServer(function(request, response){ /* request handler here
*/}).listen(port,host);
};
The function passed to http.createServer could just as easily be given to
expressJS. The self/this variables would need to be figured out, but other
than that it would work fine. In my implementation I put the function in a
seperate property of SimpleServer.prototype and added a self variable as
the first argument, and then passed it to app.use as
server.requestHandler.bind(this,server); and in server.js
...bind(this,this);
That's one way of doing it, and although it seems like according to
convention it shouldn't be part of the prototype, but that seems to work
the best.
On Tue, Jan 5, 2016 at 10:28 AM, Jeremy Ruston <[email protected]>
wrote:
> Hi Arlen
>
> Great stuff, thanks for sharing.
>
> If server.js exposed it's listen handler, and excepted a state argument or
> something like that, I could just use it without copying out the code, I
> think.
>
>
> I’d be open to that kind of refactoring. Can you point at an example of
> app that does the right thing?
>
> Best wishes
>
> Jeremy.
>
>
> Have a good day,
> -Arlen
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/CAJ1vdSRseJmXeBfJz_kHkYFDuixWnCx0YASNb10tKZ7z66Qu9Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/tiddlywiki/CAJ1vdSRseJmXeBfJz_kHkYFDuixWnCx0YASNb10tKZ7z66Qu9Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/9E75F52D-DEDA-46E3-A026-64A050AFA885%40gmail.com
> <https://groups.google.com/d/msgid/tiddlywiki/9E75F52D-DEDA-46E3-A026-64A050AFA885%40gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/CAJ1vdSRKfTHddF7Ys%3DWz3s3T3GSq1nVr_ksXUn5%3DCQPgSYOy5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.