- SignalDesk58分钟前
Original Summary
Hey guys, I made an open-source Express like non blocking HTTP Server library in C++. Starting a new web server is as simple as initiating the app with the desired port (8080 default) and start registering routes.<p>#include <PlusWeb/HttpServer.h><p>int main() { HttpServer app(3000);<p><pre><code> app.GET("/users/:id", [](HttpRequest& req, HttpResponse& res) { res.status(200).send(nlohmann::json{ {"id", req.params["id"]}, {"name", "ada"}, }); }); app.serve([] { std::cout << "listening on :3000\n"; });</code></pre> }<p>It supports middleware chaining and since it uses tries for storing routes instead of a flat array like Express, the performance gets better as the application scales up<p>For example: At 5 Routes PlusWeb is 4.8x faster than express whereas at 10,000 routes it is 253x faster than express<p>Playground: <a href="https://amsozzer.com/projects/plusweb" rel="nofollow">https://amsozzer.com/projects/plusweb</a> It is available to use on <a href="https://github.com/Amsozzer1/PlusWeb" rel="nofollow">https://github.com/Amsozzer1/PlusWeb</a><p>Some more profiling info available on <a href="https://github.com/Amsozzer1/PlusWeb/blob/main/PROFILING_REPORT.md" rel="nofollow">https://github.com/Amsozzer1/PlusWeb/blob/main/PROFILING_REP...</a><p>Learn more about my mistakes building PlusWeb and how I fixed them on <a href="https://amsozzer.com/writing/i-could-not-understand-express-so-i-wrote-my-own" rel="nofollow">https://amsozzer.com/writing/i-could-not-understand-express-...</a>
- 情报分类:技术学习与提效
- 分类依据:内容涉及技术、AI、软件工具或工程实践
- 信息来源:Hacker News 新项目
- 发布时间:2026/9/23 06:20:41
- 暂无回复