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

Add HTTP server API #726

Closed
ry opened this issue Sep 10, 2018 · 11 comments
Closed

Add HTTP server API #726

ry opened this issue Sep 10, 2018 · 11 comments
Milestone

Comments

@ry
Copy link
Member

ry commented Sep 10, 2018

Example:

import * as deno from "deno";
const enc = new TextEncoder();
function handler(req: deno.HTTPRequest, res: deno.HTTPResponse) {
  let ab = enc.encode(`hello ${req.url.path}`);
  w.write(ab);
}
deno.httpServe(":8080", handler);

#725 should be completed first.

@ry ry added this to the future milestone Sep 10, 2018
@sijad
Copy link
Contributor

sijad commented Sep 10, 2018

http should implemented in js side instead of using hyper in rust side?

@ry
Copy link
Member Author

ry commented Sep 10, 2018

@sijad it should use hyper - we want to avoid reimplementing http

@sijad
Copy link
Contributor

sijad commented Sep 10, 2018

so why does #725 should be completed first?

@ry
Copy link
Member Author

ry commented Sep 10, 2018

@sijad because TCP is simpler and I anticipate more work will need to be done in the binding interface.

@Janpot
Copy link

Janpot commented Sep 11, 2018

Probably not relevant anymore, but there were some ideas thrown around in #199

@ry
Copy link
Member Author

ry commented Oct 3, 2018

@Janpot I'm starting on the http server now. I really like your idea of an inverse fetch. I probably won't do this for the first pass implementation - we need to get something simple working first - but I will explore it once we have some basic examples working.

Also: we need to support streaming bodies from fetch() (#522) before we can think about server inverse.

@ry ry modified the milestones: future, v0.2 Oct 11, 2018
@lenkan
Copy link
Contributor

lenkan commented Oct 28, 2018

Love this project. I played around with it today and created simple http server library on top of the TCP-api. Is the plan still to add this API to deno or leave it for external libraries? Anyways, I ended up with this: (https://github.com/lenkan/deno-http). Let me know if it is something useful. If the plan is to use Hyper, I guess it's pretty irrelevant.

@somombo
Copy link

somombo commented Nov 25, 2018

@ry I suppose line 5 of example was meant to be res.write(ab); ?

@ry
Copy link
Member Author

ry commented Jan 4, 2019

We have an http server API that working for several people in
https://github.com/denoland/deno_std/blob/2916791dfb14bf486185eca6c7859b49c1c4c052/net/http.ts
It is not very fast - but we have several larger performance refactors planned which we think may address that. Therefore closing this issue for now. If we can't make it fast enough, it may need to be implemented natively.

@ry ry closed this as completed Jan 4, 2019
@brandonros
Copy link

but we have several larger performance refactors planned

Are those documented anywhere?

@ry
Copy link
Member Author

ry commented Jan 7, 2019

Are those documented anywhere?

Unfortunately not well. I can try to write up some more but it’s partially here
#1010

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

6 participants