@@ -2,7 +2,12 @@ import std.stdio;
22import std.socket ;
33import std.array ;
44
5- import asdf.serialization;
5+ import mir.ser;
6+ import mir.ser.json;
7+
8+ import std.range.primitives ;
9+
10+ import glow.xbuf;
611
712import photon, photon.http;
813
@@ -14,18 +19,18 @@ struct Message
1419class BenchmarkProcessor : HttpProcessor {
1520 HttpHeader [] plainText = [HttpHeader (" Content-Type" , " text/plain; charset=utf-8" )];
1621 HttpHeader [] json = [HttpHeader (" Content-Type" , " application/json" )];
17- Appender ! ( char []) jsonBuf;
22+ Buffer ! char jsonBuf;
1823 this (Socket sock) {
1924 super (sock);
20- jsonBuf = appender ! ( char [] );
25+ jsonBuf = Buffer ! char ( 256 );
2126 }
2227
2328 override void handle (HttpRequest req) {
2429 if (req.uri == " /plaintext" ) {
2530 respondWith(" Hello, world!" , 200 , plainText);
2631 } else if (req.uri == " /json" ) {
2732 jsonBuf.clear();
28- Message(" Hello, World!" ).serializeToJsonPretty ! " " (jsonBuf );
33+ serializeJsonPretty ! " " (jsonBuf, Message(" Hello, World!" ));
2934 respondWith(jsonBuf.data, 200 , json);
3035 } else {
3136 respondWith(" Not found" , 404 , plainText);
0 commit comments