{"id":16931970,"url":"https://github.com/catcherwong/nancy.response.messagepack","last_synced_at":"2025-10-07T17:32:13.350Z","repository":{"id":130595208,"uuid":"116481052","full_name":"catcherwong/Nancy.Response.MessagePack","owner":"catcherwong","description":"MessagePack Response for Nancy.","archived":false,"fork":false,"pushed_at":"2018-01-09T15:20:13.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-01T08:02:17.626Z","etag":null,"topics":["messagepack","msgpack","nancy","response"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/catcherwong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-06T12:26:52.000Z","updated_at":"2018-08-22T01:41:28.000Z","dependencies_parsed_at":"2023-07-09T06:01:01.904Z","dependency_job_id":null,"html_url":"https://github.com/catcherwong/Nancy.Response.MessagePack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/catcherwong/Nancy.Response.MessagePack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catcherwong%2FNancy.Response.MessagePack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catcherwong%2FNancy.Response.MessagePack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catcherwong%2FNancy.Response.MessagePack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catcherwong%2FNancy.Response.MessagePack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catcherwong","download_url":"https://codeload.github.com/catcherwong/Nancy.Response.MessagePack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catcherwong%2FNancy.Response.MessagePack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278813470,"owners_count":26050562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["messagepack","msgpack","nancy","response"],"created_at":"2024-10-13T20:45:09.115Z","updated_at":"2025-10-07T17:32:13.075Z","avatar_url":"https://github.com/catcherwong.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nancy.Responses.MessagePack\n\nThere are many response type we can choose when we use Nancy to build our Web API . For example , JSON , XML , ProtBuf . etc .\n\nJSON is the most popular , but there are a few pros in replacing the default JSON serializator in Nancy with MessagePack:\n\n- JSON uses 4 bytes to represent null, MessagePack only requires 1 byte;\n- JSON uses 2 bytes to represent a typical int, MessagePack requires 1 byte and so on;\n- MessagePack is faster to read and write than JSON.\n\nProtBuf is also a good choose , but when we use ProtBuf , we need to mark our class as `[ProtoContract]` and public members(property or field) mark as `[ProtoMember]`. This is a little complex!\n\nSo `Nancy.Responses.MessagePack` is come ! `Nancy.Responses.MessagePack` use [MessagePack-CSharp](https://github.com/neuecc/MessagePack-CSharp) as the default Serializer.\n\n## Quick Start\n\n### Instatll the package at first\n\n```\nInstall-Package Nancy.Response.MessagePack\n```\n\n### Define A Class\n\n```csharp\npublic class User\n{\n    public string Name { get; set; }\n    public int Age { get; set; }\n}\n```\n\n### Specify MessagePack Response\n\n```csharp\nusing Nancy.Responses;\n\npublic class MainModule : NancyModule\n{\n    public MainModule()\n    {\n        Get(\"/{name}/{age}\", _ =\u003e\n        {\n            var data = new User { Name = args.name, Age = args.age };\n            return Response.AsMessagePack(data);\n        });\n\n        Get(\"/other\", _ =\u003e\n        {            \n            return Response.AsMessagePack(\"your value\");\n        });\n    }\n}\n```\n\n### Based On User's Request\n\n```csharp\npublic class MainModule : NancyModule\n{\n    public MainModule()\n    {\n        Get(\"/{name}/{age}\", args =\u003e\n        {\n            var data = new User { Name = args.name, Age = args.age };\n            return Negotiate.WithModel(data);\n        });\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatcherwong%2Fnancy.response.messagepack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatcherwong%2Fnancy.response.messagepack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatcherwong%2Fnancy.response.messagepack/lists"}