码云 IDEA 插件最新版本发布,支持 Pull Request

泥水佬 / FastHttpApiC#Apache-2.0

指数
0
Watch 9 Star 21 Fork 5
加入码云
与超过 300 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
基于dotcore实现的一个高度精简化和高吞吐的HTTP API服务组件,它并没有完全实现HTTP SERVER的所有功能,而是只实现了在APP和WEB中提供数据服务最常用两个指令GET/SET,满足在应用实现JSON,PROTOBUF和MSGPACK等基于HTTP的数据交互功能,虽然是一个精简版本但针对SSL这方面的安全性还是支持。有牺牲就必然有收获,FastHttpApi作出这么大的精简必然在性能上有所收获取,经测试FastHttpApi在GET... 展开 收起

Loading...
README.md

introduction

Fasthttpapi is a lightweight and high-performance HTTP service component in the dotnet core platform that supports WebSocket and SSL!Document.

Personal blog websites system built on Beetlex.FastHttpApi framework

https://github.com/IKende/XBlog

Online case

https://www.ikende.com

PerformanceTest

master/PerformanceTest

Cluster configuration

Cluster configuration project

using

Install Packet

Install-Package BeetleX.FastHttpApi -Version 0.9.9.7

Setting Server GC

<ServerGarbageCollection>true</ServerGarbageCollection>

sample code

    [Controller]
    class Program
    {
        private static BeetleX.FastHttpApi.HttpApiServer mApiServer;
        static void Main(string[] args)
        {
            mApiServer = new BeetleX.FastHttpApi.HttpApiServer();
            mApiServer.Debug();
            mApiServer.Register(typeof(Program).Assembly);
            mApiServer.Open();
            Console.Write(mApiServer.BaseServer);
            Console.Read();
        }
        // Get /hello?name=henry 
        // or
        // Get /hello/henry
        [Get("{name}")]
        public object Hello(string name)
        {
            return $"hello {name} {DateTime.Now}";
        }
        // Get /GetTime  
        public object GetTime()
        {
            return DateTime.Now;
        }
        // Post /PostStream
        // name=aaa&value=bbb
        [Post]
        [NoDataConvert]
        public object PostStream(IHttpContext context)
        {
            Console.WriteLine(context.Data);
            string value = context.Request.Stream.ReadString(context.Request.Length);
            return value;
        }
        // Post /Post
        // {"name":"henry","value":"bbbb"}
        [Post]
        public object Post(string name, string value, IHttpContext context)
        {
            Console.WriteLine(context.Data);
            return $"{name}={value}";
        }
        
        // Post /PostForm
        // name=aaa&value=bbb
        [Post]
        [FormUrlDataConvert]
        public object PostForm(string name, string value, IHttpContext context)
        {
            Console.WriteLine(context.Data);
            return $"{name}={value}";
        }
    }

samples

monitoring and management Services

Install Packet

Install-Package BeetleX.FastHttpApi.Admin -Version 0.6.2

Registering management controller

mApiServer.Register(typeof(BeetleX.FastHttpApi.Admin._Admin).Assembly);

access url

/_admin/index.html

点评 ( 2 )

你可以在登录后,发表评论

搜索帮助