Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Become Nest Compatible #24

Open
Danappelxx opened this issue Nov 4, 2015 · 1 comment
Open

[Suggestion] Become Nest Compatible #24

Danappelxx opened this issue Nov 4, 2015 · 1 comment

Comments

@Danappelxx
Copy link
Collaborator

Nest is a specification for Swift web-servers to allow them to be interchangeable between different frameworks. Here's the specification itself.

Making Taylor support Nest is a challenge but it would make the code easier to work with in the long run. Obviously Taylor would be quite a few layers above the base Nest specification, but the Nest-compatible methods should still be accessible so that other frameworks built on top of Taylor can access them internally.

Nest's creator (kylef) noted:

I'd imagine that Taylor would be split into two components itself. The underlying server would just offer the Nest interface. The other part would be a micro framework that utilises the Nest compatible interface and provides the interface that Taylor provides.

The most difficult part of implementing the specification would be the fact that the main application function returns the response object synchronously, with no callback involved.

We've discussed the callback system before in issue #12, but didn't really get anywhere. I've been searching for alternatives to how the current system is implemented for a while now, and I've come up with a couple viable ideas which would allow us to be Nest-compatible:

  • Use semaphores (example) internally, creating a new thread for each request handler & blocking it until the callback has been executed.
  • Switch to a synchronous handler (as suggested here):
 typealias Handler = (Request, Response) -> (Request, Response)

Tell me what you think! Personally I think the ideas behind Nest are really neat and it would allow frameworks to be built around multiple servers instead of binding to a single one internally - which opens up a huge window of possibilities.

@Danappelxx
Copy link
Collaborator Author

Now that we made Taylor synchronous, this discussion should be revived (started?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant