2020-12-01 14:22

Add doc for Server[Under Technical Review...]

Ready for a technical Review.

  • Add Server concept
  • Add doc of how to implement a Server
  • The example contains an event listener, and after start the app, events are emitted periodically. Kind of mocking a server interacting with events from outside.


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • weixin_39667652 weixin_39667652 5月前

    applied, thanks!

    点赞 评论 复制链接分享
  • weixin_39604516 weixin_39604516 5月前

    great comments. I think you know much more about Servers than I do, I am happy to let you drive this one.

    do not say that Server is a Context. Your implementations of Server can extend Context, but nothing requires it.

    Slightly related: I think it's important to explicitly say that the routing implementation must create a new child context for each request handled, and explain why is this important (each request has different request-specific values bound to the context).

    A per-server context is optional, a per-request context is required.

    点赞 评论 复制链接分享
  • weixin_39604516 weixin_39604516 5月前

    Few more comments:

    • Could you please update the pull request title to make it more clear that this is documentation for people writing servers, not for consumers (application developers)?
    • Please add the new page to the sidebar. I think it should be somehow related or close to http://loopback.io/doc/en/lb4/Extending-LoopBack-4.html and http://loopback.io/doc/en/lb4/Creating-components.html.
    点赞 评论 复制链接分享
  • weixin_39667652 weixin_39667652 5月前

    The general concept of what a Server is should be done as a separate document, covered by this task,

    I am not sure why the same concept's "definition" and "implementation" should be documented separately.

    while this document should describe what you want to do to make your own implementation.

    The whole things I wrote is my understanding of what I need to do to make my own implementation.

    This document doesn't have a logical flow to follow,

    Have you really carefully read what I wrote? There is a flow: each sub title means a step, and I document them in the same order as how you built the timer app.

    and while the example of a custom Server is a good start, it doesn't do enough to cover the fundamentals of how to make a useful server implementation.

    after making a Server's concept very generic as a worker, I don't know what are the other "useful" things I need to include in the implementation. "fundamentals of how to make a useful server implementation" I don't know what do you mean by "fundamentals" here.

    There was no mention of the core concept of a router in this Pull Request, which we discussed yesterday as being the only "best practice" we need to mention (since people will most likely use controllers, we need a router to work with that concept).

    "route" is not a must-have concept in a generic Server, if it is a must-have concept of some Server , I would suggest someone put down the definition of the "some Server" and also put down the elements to build in a best practice.

    From my understanding, "some Server" is a Web Server, and the elements are Sequence, Router.

    And moreover, I think at the end of the meeting we don't have an agreement of the best practise due to the complexity of sample app's implementation.

    Making a server with connectivity (AdvancedServer) Adding routing to your AdvancedServer

    Same concern as above.

    do not say that Server is a Context. Your implementations of Server can extend Context, but nothing requires it.

    OK fine, this is the most fundamental thing I can see to start your Server impt with, if it's not, then I really have no idea how are you going to define your Server.

    do not mention "state". Servers do not require state tracking, or possess it as an innate quality, and this will only serve to confuse others.

    Again, this is my understanding, and if that's not correct, someone please give a clear definition of Server.

    点赞 评论 复制链接分享
  • weixin_39667652 weixin_39667652 5月前

    I am closing this PR since most of its content doesn't seem on the right track.

    点赞 评论 复制链接分享