{"id":20098624,"url":"https://github.com/pfnet/jasco","last_synced_at":"2025-10-06T03:48:24.589Z","repository":{"id":57589224,"uuid":"53077782","full_name":"pfnet/jasco","owner":"pfnet","description":"Compact JSON API Server library built upon gocraft/web","archived":false,"fork":false,"pushed_at":"2017-08-17T17:56:06.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":110,"default_branch":"master","last_synced_at":"2025-01-13T03:45:38.035Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/pfnet.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}},"created_at":"2016-03-03T19:39:11.000Z","updated_at":"2018-02-04T16:52:28.000Z","dependencies_parsed_at":"2022-09-15T18:02:56.642Z","dependency_job_id":null,"html_url":"https://github.com/pfnet/jasco","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet%2Fjasco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet%2Fjasco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet%2Fjasco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet%2Fjasco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pfnet","download_url":"https://codeload.github.com/pfnet/jasco/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241536843,"owners_count":19978410,"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","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":[],"created_at":"2024-11-13T17:06:05.323Z","updated_at":"2025-10-06T03:48:19.537Z","avatar_url":"https://github.com/pfnet.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jasco: Compact JSON API Server library version 1\n\njasco is a compact library to build a JSON API server. It's written in Go and\nbuilt on github.com/gocraft/web.\n\n## Requirements\n\njasco requires Go 1.4.2 or later.\n\n## Installation\n\n```\n$ go get gopkg.in/pfnet/jasco.v1\n```\n\n## Example\n\n`example.go`:\n```go\npackage main\n\nimport (\n    \"net/http\"\n\n    \"github.com/gocraft/web\"\n    \"gopkg.in/pfnet/jasco.v1\"\n)\n\ntype Context struct {\n    *jasco.Context\n}\n\nfunc (c *Context) Get(rw web.ResponseWriter, req *web.Request) {\n    c.Render(map[string]interface{}{\n        \"hello\": \"world\",\n        \"num\":   10,\n        \"obj\": map[string]interface{}{\n            \"a\": 1,\n            \"b\": \"2\",\n            \"c\": []interface{}{3.4, \"5\"},\n        },\n    })\n}\n\nfunc (c *Context) Echo(rw web.ResponseWriter, req *web.Request) {\n    var js map[string]interface{}\n    if err := c.ParseBody(\u0026js); err != nil {\n        c.ErrLog(err.Err).Error(\"Cannot parse the request body\")\n        c.RenderError(err)\n        return\n    }\n    c.Render(js)\n}\n\nfunc main() {\n    root := jasco.New(\"\", nil)\n    router := root.Subrouter(Context{}, \"/\")\n    router.Get(\"/\", (*Context).Get)\n    router.Post(\"/\", (*Context).Echo)\n    http.ListenAndServe(\":10080\", root)\n}\n\n```\n\nRun the example:\n```\n$ go run sample.go\n```\n\nTest:\n```\n$ curl http://localhost:10080/\n{\"hello\":\"world\",\"num\":10,\"obj\":{\"a\":1,\"b\":\"2\",\"c\":[3.4,\"5\"]}}\n$ curl -XPOST -d'{\"test\":\"data\"}' http://localhost:10080/\n{\"test\":\"data\"}\n```\n\n## Logging\n\njasco uses github.com/sirupsen/logrus as a logger. Pass a logger that the\napplication uses to `jasco.New`. By default, the default logger of logrus will\nbe used.\n\n`Context.AddLogField(\"field\", value)` adds a field to be logged by logrus.\nBecause gocraft/web creates a context for each request, a field added to\nthe context is only available while the request is being processed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpfnet%2Fjasco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpfnet%2Fjasco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpfnet%2Fjasco/lists"}