Comments (11)
Several API endpoint have been implemented using HTTPP already.
The server will handle the request for you and call the function you defined. You can take a look at some of the examples:
- Small (not so featured) helper to dispatch request depending on the endpoint: https://github.com/daedric/httpp/blob/master/examples/rest/rest.cpp
- Shortest amount of code to get a server running: https://github.com/daedric/httpp/blob/master/examples/ping/ping.cpp
The connection you get in the callback can be kept as long as you decide. HTTPP does not put any constraints on when you have to answer.
For instance this library is used in some RTB project where we keep the connection for about 200msec waiting for an answer or we send back a 204.
Do not hesitate if you have more questions :)
from httpp.
I'm really glad to ear it.
Do not hesitate to create issues if you need help with anything
cheers
from httpp.
Hi,
The server and client are already async and support multithreading.
Can you elaborate on what you need ? :)
from httpp.
@daedric Hi Thomas, I am trying to write an API server serving JSON. What do you suggest ?
from httpp.
Thank you Thomas, great help, got it now :)
from httpp.
@daedric Thomas, dont mind me asking where do you use this in your work and what for ?
from httpp.
Not at all,
So as previously said it is used as a RTB gateway. It receives a decent amount of traffic that gets normalized and sent to a backend that will compute an answer. If the answer does not come before the timeout, a standard answer is sent (204).
It is also used as internal REST service with low traffic. In this case C++ is overkill but in the project using HTTPP the code was able to reuse some existing C++ code avoiding a code duplication.
And more recently it is used at my previous job as a gateway once again, very similar to the RTB use case but without the need to wait for an answer from the backend.
It is production ready and proven very stable and efficient. Compared to some of the alternatives (which were not existing at the time the first version was written) it is also much smaller.
It is worth mentioning that HTTPP is to be behind a nginx or some other full featured and more secure server or only open to some trusted network.
from httpp.
Thanks for the reply Thomas, would you happen to have an example for the nginx proxy to server ? Also have you considered plugging an lwan backend ?
from httpp.
About nginx look up upstream
block and the proxy_pass
statement.
About lwan yes, it was a strong possibility but it had and has too many features we did not need (mime, files, compression, etc.) and more; therefor, HTTPP core is about half of lwan's.
It was also not advertised as something stable in 2013.
Long story short, HTTPP aims as being as simple as possible, if you want to serve files this is certainly not the library to use.
from httpp.
Great !, Thank You Thomas for the nginx refrence.
from httpp.
@daedric Good News Thomas, I have decided to use this Library !
from httpp.
Related Issues (6)
- Support file protocol. HOT 2
- Can I use it in C? HOT 1
- Custom Paths HOT 10
- cant use vcpkg download it? HOT 6
- no .hpp file in the path /httpp/http/ ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httpp.