Giter VIP home page Giter VIP logo

Comments (8)

dom96 avatar dom96 commented on May 24, 2024 1

Unfortunately I cannot predict everything and to be fair the httpbeast readme is indeed very barebones.

But sure, I'll add this particular tip to the readme.

from httpbeast.

dom96 avatar dom96 commented on May 24, 2024

Not much more to it than this: https://github.com/dom96/httpbeast/blob/master/tests/helloworld.nim

from httpbeast.

andreaferretti avatar andreaferretti commented on May 24, 2024

Ok, seems easy. It will only be complicated to handle both asynchttpserver and httpbeast since the Request objects are pretty different, but I hope to be able to implement some compatible api.

Just one doubt: I see

proc send*(req: Request, code: HttpCode, body: string, headers="") =
  ## Responds with the specified HttpCode and body.
  ##
  ## **Warning:** This can only be called once in the OnRequest callback.

For chunked responses I can use unsafeSend, right?

from httpbeast.

Stuffe avatar Stuffe commented on May 24, 2024

Documentation would be nice (aka make it actually useful). How do you do POST requests?...

from httpbeast.

dom96 avatar dom96 commented on May 24, 2024

https://github.com/dom96/httpbeast/blob/master/tests/dispatcher.nim#L16

The best documentation sometimes is tests :)

from httpbeast.

Stuffe avatar Stuffe commented on May 24, 2024

How do I set headers/cookies then, that doesn't seem to be in the tests. I think most people who didn't code the whole thing themselves think actual documentation is always the best documentation...

from httpbeast.

dom96 avatar dom96 commented on May 24, 2024

Sure, but I'd say you shouldn't be afraid to look into the code, especially for something as low-level as httpbeast. Maybe you'd be better off using Jester?

from httpbeast.

Stuffe avatar Stuffe commented on May 24, 2024

So yesterday I also figured out how to use headers and set cookies, by reading the code as you say. But then I ran into not being able to serve static binary files and I went to Jester as you also say. I understand that you do all this for free and I have no right to complain, but you have knowledge that you can probably hash out in 10 minutes that would have saved me and many others in the future 2 hours of figuring things out.

I want to build a real website (with sessions/cookies/static files/post requests) and the way I came to this project was through a list of names all unknown to me. This project stood out for being fast, so it was the first one I tried. Had I known this was more specific I would have gone to Jester. Just 1 sentence about "This is for X, if you want something general I suggest you check out Jester" could have saved me 2 hours

from httpbeast.

Related Issues (20)

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.