Giter Club home page Giter Club logo

purescript-node-http's People

Contributors

anilanar avatar garyb avatar hdgarrood avatar jmatsushita avatar jordanmartinez avatar justinwoo avatar kika avatar kl0tl avatar kritzcreek avatar lpil avatar paf31 avatar sigma-andex avatar thomashoneyman avatar vfabricio avatar zelenya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

purescript-node-http's Issues

Won't install with yarn

Hi, using yarn I get

$ yarn add purescript-node-http                                   
...
error Couldn't find package "purescript-node-http" on the "npm" registry.

ok, let's use the git form:

yarn add https://github.com/purescript-node/purescript-node-http
...
error Package "undefined@undefined" doesn't have a "name".

guess there's something missing in the yarn descriptor?

https support

It would be nice to support node's https module -- as far as I know, the API is the same.

Error handling

It seems there is no way to attach error handlers to HTTP servers. Am I missing something?

E.g. the equivalent of the following JS:

var s = http.createServer(h);
s.on('error', function(err) { console.log('oops!', err); });
s.listen(9000); // in case of failure, will call the above callback

Ensure that tests terminate

Currently, CI fails (as described in #33) because the the tests leave servers running until they are manually torn down. This results in timeout failures as in this failed run. We should fix the tests so that they terminate.

add support for server.address()

there is already support for this method in https://github.com/purescript-node/purescript-node-net/blob/1fd91c872ecff202ae86b848f2c8d054f7a751f3/src/Node/Net/Server.purs#L72-L88

string means ICP or pipe of socket

http.server inherits from net.server

https://nodejs.org/api/http.html#http_class_http_server

the question is can it return String if server is created using purescript-node-http?

i.e. should it be

address :: Server -> Effect (Maybe (Either Address String))

or

address :: Server -> Effect (Maybe Address)

HTTP.createServer then close after one connection

I want to close an HTTP server after one connection. It seems to be impossible? The variable server is not defined at close server.

  server <- createServer \request response -> do
    respond request response
    close server (pure unit)

It looks like this is impossible because the Node.js API is bad. createServer is just a wrapper for the Node.js http.createServer function. But still.

add support for the `upgrade` event

Hi! I am toying with the idea of writing a web socket server in Purescript. That would require access to the upgrade events emitted by Node's HTTP servers. It seems like this is not currently supported, right?

I think something like onUpgrade :: Server -> (Request -> Socket -> Buffer -> Effect Unit) -> Effect Unit would do the trick.

I understand this a niche use case and that client code could go down to the FFI and wrap this itself. But, since this is part of Node's public API, maybe it would make sense to expose this functionality here.

If this sounds like something that this library would want to support, I'd be happy to submit a PR.

Add support for `connection`

The node.js http module has had support for request.connection for ages (since version 0.3.0), it's just been poorly documented. Up until the 8.x series it was tucked away in the comment of the 'connection' event. Since then, it's had its own documentation. I'd like to propose we add support for connection, but it will require some work for the Socket it returns.

My guess (and what I mentioned on slack) is that we'll want a purescript-node/purescript-node-net package, where we have Socket and all its facilities defined. If that's the case, I'm more than happy to do the work if someone can make the repo. Then, we can expose connection :: Node.HTTP.Request -> Node.Net.Socket. Does that sound about right?

responseHeaders's runtime representation isn't necessarily a StrMap String

When running tests for one of my libraries, I tried to print the responseHeaders from a Response and got the following:

Response headers:

TypeError: s.replace is not a function
    at exports.showStringImpl (/home/thimotron/Programming/purescript-simple-request/output/Prelude/foreign.js:23
1:19)

I tracked it down to the fact that the responseHeaders in question had a "set-cookie" key with an Array String value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.