All Projects → hongliuliao → Ehttp

hongliuliao / Ehttp

Licence: apache-2.0
simple http server base on epoll

Projects that are alternatives of or similar to Ehttp

Nano
Lightweight, facility, high performance golang based game server framework
Stars: ✭ 1,888 (+594.12%)
Mutual labels:  json, server
Laravel5 Jsonapi
Laravel 5 JSON API Transformer Package
Stars: ✭ 313 (+15.07%)
Mutual labels:  microservices, json
Jstp
Fast RPC for browser and Node.js based on TCP, WebSocket, and MDSF
Stars: ✭ 132 (-51.47%)
Mutual labels:  json, server
Gophergameserver
🏆 Feature packed, easy-to-use game server API for Go back-ends and Javascript clients. Tutorials and examples included!
Stars: ✭ 61 (-77.57%)
Mutual labels:  json, server
Micro
Micro is a distributed cloud operating system
Stars: ✭ 10,778 (+3862.5%)
Mutual labels:  microservices, server
Deta cache
缓存cache服务器
Stars: ✭ 106 (-61.03%)
Mutual labels:  json, server
Autoserver
Create a full-featured REST/GraphQL API from a configuration file
Stars: ✭ 188 (-30.88%)
Mutual labels:  json, server
Dyson
Node server for dynamic, fake JSON.
Stars: ✭ 814 (+199.26%)
Mutual labels:  json, server
Brutusin Rpc
Self-describing JSON-RPC web services over HTTP, with automatic API description based on JSON-Schema
Stars: ✭ 36 (-86.76%)
Mutual labels:  microservices, json
Crony
Cron scheduler as a service 🕠
Stars: ✭ 9 (-96.69%)
Mutual labels:  microservices, server
Dito
Dito.js is a declarative and modern web framework with a focus on API driven development, based on Objection.js, Koa.js and Vue.js – Released in 2018 under the MIT license, with support by Lineto.com
Stars: ✭ 44 (-83.82%)
Mutual labels:  json, server
Bricks
A standard library for microservices.
Stars: ✭ 142 (-47.79%)
Mutual labels:  microservices, json
Borealis Server Manager
Utility designed to facilitate the deployment, management, and control of various kinds of dedicated gameservers.
Stars: ✭ 31 (-88.6%)
Mutual labels:  json, server
Zoya
Truly highly composable logging utility
Stars: ✭ 116 (-57.35%)
Mutual labels:  json, server
Clientserverproject
一个C-S模版,该模版由三部分的程序组成,一个服务端运行的程序,一个客户端运行的程序,还有一个公共的组件,实现了基础的账户管理功能,版本控制,软件升级,公告管理,消息群发,共享文件上传下载,批量文件传送功能。具体的操作方法见演示就行。本项目的一个目标是:提供一个基础的中小型系统的C-S框架,客户端有三种模式,无缝集成访问,winform版本,wpf版本,asp.net mvc版本,方便企业进行中小型系统的二次开发和个人学习。同时网络组件方便的支持读写三菱和西门子PLC的数据,详细见Readme
Stars: ✭ 873 (+220.96%)
Mutual labels:  json, server
Smoke
💨 Simple yet powerful file-based mock server with recording abilities
Stars: ✭ 142 (-47.79%)
Mutual labels:  json, server
Ngrest
Fast and easy C++ RESTful WebServices framework
Stars: ✭ 357 (+31.25%)
Mutual labels:  json, server
Ponzu
Headless CMS with automatic JSON API. Featuring auto-HTTPS from Let's Encrypt, HTTP/2 Server Push, and flexible server framework written in Go.
Stars: ✭ 5,373 (+1875.37%)
Mutual labels:  json, server
Problem
A Java library that implements application/problem+json
Stars: ✭ 541 (+98.9%)
Mutual labels:  microservices, json
Symfony Jsonapi
JSON API Transformer Bundle for Symfony 2 and Symfony 3
Stars: ✭ 114 (-58.09%)
Mutual labels:  microservices, json

ehttp

C/C++ CI Build Status codecov.io

This library make http (with json) microservice easy!

Feature

  • Base on linux epoll
  • Multi-thread model

Performance (without log print)

  • Connect per request: qps 12000+ (ab -c 10 -n 10000 localhost:3456/hello)
  • Connection keep alive: qps 18000+ (ab -c 10 -n 10000 -k localhost:3456/hello)

Build && Test

 make && make test && ./output/test/hello_server 3456
 curl "localhost:3456/hello"

Function List

  • http 1.0/1.1(keep-alive support) GET/POST request
  • response as json format

Example

#include <sstream>
#include <cstdlib>
#include "simple_log.h"
#include "http_server.h"

// Make sure the callback method is threadsafe
void login(Request &request, Json::Value &root) {
    std::string name = request.get_param("name");
    std::string pwd = request.get_param("pwd");

    LOG_DEBUG("login user which name:%s, pwd:%s", name.c_str(), pwd.c_str());
    
    root["code"] = 0;
    root["msg"] = "login success!";
}

int main() {
    HttpServer http_server;
    
    http_server.add_mapping("/login", login, POST_METHOD);

    http_server.set_port(3456);
    http_server.start_sync();
    return 0;
}

Run

[email protected]:~/workspace/ehttp$ curl -d "name=tom&pwd=3" "localhost:3456/login"
{"code":0,"msg":"login success!"}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].