www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Archttp - Fast and easy to use web framework.

reply zoujiaqing <zoujiaqing gmail.com> writes:
Hi, everybody.

The epidemic in China is serious. I am in home quarantine in 
Shanghai.

I used to write a lot of frameworks. But they are huge and 
difficult to use.

I've always wanted to design a lightweight Web framework that is 
easy to use and has good performance. These days I finally write 
a version. This version currently runs well on Linux and macOS. 
We haven't had time to test it on Windows yet.


```D
import archttp;

void main()
{
     auto app = new Archttp;

     app.Bind(8080);

     app.Get("/", (context) {
         auto response = context.response();
         response.body("Hello Archttp");
     });

     app.Get("/json", (context) {
         import std.json;

         auto response = context.response();
         auto j = JSONValue( ["message" : "Hello, World!"] );

         response.json(j);
     });

     app.Get("/user/{id:\\d+}", (context) {
         auto request = context.request();
         auto response = context.response();
         response.body("User id: " ~ request.parameters["id"]);
     });

     app.Get("/blog/{name}", (context) {
         auto request = context.request();
         auto response = context.response();
         response.body("Username: " ~ request.parameters["name"]);
     });

     app.Post("/upload", (context) {
         auto response = context.response();
         response.body("Using post method!");
     });

     app.Run();
}

```

The project relies on 'nbuff' and 'httparsed', which provide very 
powerful support for 'Archttp'.

  ** Thanks to 'ikod' and 'Tchaloupka'.**

Be aware that there will be many changes and tweaks to the API in 
the future. It's not a stable version yet.

The current project supports HTTP 1.1 request processing. And a 
good built-in routing module.


```bash
git clone https://github.com/kerisy/archttp.git
cd archttp/examples/httpserver/
dub run
```


https://github.com/kerisy/archttp
May 14
next sibling parent reply zjh <fqbqrr 163.com> writes:
On Saturday, 14 May 2022 at 14:58:52 UTC, zoujiaqing wrote:
 Hi, everybody.

 The epidemic in China is serious. I am in home quarantine in 
 Shanghai.
Shanghaier, is it easy to be harmed by the leaders?
May 14
parent reply Domain <dont_email empty.com> writes:
On Saturday, 14 May 2022 at 15:16:42 UTC, zjh wrote:
 On Saturday, 14 May 2022 at 14:58:52 UTC, zoujiaqing wrote:
 Hi, everybody.

 The epidemic in China is serious. I am in home quarantine in 
 Shanghai.
Shanghaier, is it easy to be harmed by the leaders?
静默已经够辛苦了,何必聊天还要说英文呢
May 14
next sibling parent reply zoujiaqing <zoujiaqing gmail.com> writes:
On Saturday, 14 May 2022 at 16:06:36 UTC, Domain wrote:
 On Saturday, 14 May 2022 at 15:16:42 UTC, zjh wrote:
 On Saturday, 14 May 2022 at 14:58:52 UTC, zoujiaqing wrote:
 Hi, everybody.

 The epidemic in China is serious. I am in home quarantine in 
 Shanghai.
Shanghaier, is it easy to be harmed by the leaders?
静默已经够辛苦了,何必聊天还要说英文呢
你们俩都在D语言中文社区群吗?
May 14
next sibling parent Domain <dont_email empty.com> writes:
On Saturday, 14 May 2022 at 16:51:02 UTC, zoujiaqing wrote:
 On Saturday, 14 May 2022 at 16:06:36 UTC, Domain wrote:
 On Saturday, 14 May 2022 at 15:16:42 UTC, zjh wrote:
 On Saturday, 14 May 2022 at 14:58:52 UTC, zoujiaqing wrote:
 Hi, everybody.

 The epidemic in China is serious. I am in home quarantine in 
 Shanghai.
Shanghaier, is it easy to be harmed by the leaders?
静默已经够辛苦了,何必聊天还要说英文呢
你们俩都在D语言中文社区群吗?
https://forums.dlangchina.com/thread/10007 这个?刚刚申请加入😀
May 14
prev sibling parent zjh <fqbqrr 163.com> writes:
On Saturday, 14 May 2022 at 16:51:02 UTC, zoujiaqing wrote:

 你们俩都在D语言中文社区群吗?
你不是不关心政治吗?受病毒欺负,都是应该的.
May 14
prev sibling parent zjh <fqbqrr 163.com> writes:
On Saturday, 14 May 2022 at 16:06:36 UTC, Domain wrote:

 静默已经够辛苦了,何必聊天还要说英文呢
上海人,不是以洋为尊吗?我这是随他们的愿.
May 14
prev sibling next sibling parent ryuukk_ <ryuukk.dev gmail.com> writes:
On Saturday, 14 May 2022 at 14:58:52 UTC, zoujiaqing wrote:
 Hi, everybody.

 The epidemic in China is serious. I am in home quarantine in 
 Shanghai.

 I used to write a lot of frameworks. But they are huge and 
 difficult to use.

 I've always wanted to design a lightweight Web framework that 
 is easy to use and has good performance. These days I finally 
 write a version. This version currently runs well on Linux and 
 macOS. We haven't had time to test it on Windows yet.


 ```D
 import archttp;

 void main()
 {
     auto app = new Archttp;

     app.Bind(8080);

     app.Get("/", (context) {
         auto response = context.response();
         response.body("Hello Archttp");
     });

     app.Get("/json", (context) {
         import std.json;

         auto response = context.response();
         auto j = JSONValue( ["message" : "Hello, World!"] );

         response.json(j);
     });

     app.Get("/user/{id:\\d+}", (context) {
         auto request = context.request();
         auto response = context.response();
         response.body("User id: " ~ request.parameters["id"]);
     });

     app.Get("/blog/{name}", (context) {
         auto request = context.request();
         auto response = context.response();
         response.body("Username: " ~ 
 request.parameters["name"]);
     });

     app.Post("/upload", (context) {
         auto response = context.response();
         response.body("Using post method!");
     });

     app.Run();
 }

 ```

 The project relies on 'nbuff' and 'httparsed', which provide 
 very powerful support for 'Archttp'.

  ** Thanks to 'ikod' and 'Tchaloupka'.**

 Be aware that there will be many changes and tweaks to the API 
 in the future. It's not a stable version yet.

 The current project supports HTTP 1.1 request processing. And a 
 good built-in routing module.


 ```bash
 git clone https://github.com/kerisy/archttp.git
 cd archttp/examples/httpserver/
 dub run
 ```


 https://github.com/kerisy/archttp
I'll check the source code, but so far it looks very nice! good job! very simple and easy to use API! Thanks for sharing!
May 14
prev sibling parent reply Sergey <kornburn yandex.ru> writes:
On Saturday, 14 May 2022 at 14:58:52 UTC, zoujiaqing wrote:
 Hi, everybody.

 The epidemic in China is serious. I am in home quarantine in 
 Shanghai.

 I used to write a lot of frameworks. But they are huge and 
 difficult to use.

 I've always wanted to design a lightweight Web framework that 
 is easy to use and has good performance. These days I finally 
 write a version. This version currently runs well on Linux and 
 macOS. We haven't had time to test it on Windows yet.



 https://github.com/kerisy/archttp
Is it somehow related to PHP version? https://github.com/kerisy-php
May 14
parent zoujiaqing <zoujiaqing gmail.com> writes:
On Saturday, 14 May 2022 at 19:46:02 UTC, Sergey wrote:
 On Saturday, 14 May 2022 at 14:58:52 UTC, zoujiaqing wrote:
 Hi, everybody.

 The epidemic in China is serious. I am in home quarantine in 
 Shanghai.

 I used to write a lot of frameworks. But they are huge and 
 difficult to use.

 I've always wanted to design a lightweight Web framework that 
 is easy to use and has good performance. These days I finally 
 write a version. This version currently runs well on Linux and 
 macOS. We haven't had time to test it on Windows yet.



 https://github.com/kerisy/archttp
Is it somehow related to PHP version? https://github.com/kerisy-php
The PHP version of Kerisy is a framework I designed 10 years ago.
May 14