{"id":22505414,"url":"https://github.com/azer/atlas","last_synced_at":"2025-10-19T06:09:30.395Z","repository":{"id":14200658,"uuid":"16907275","full_name":"azer/atlas","owner":"azer","description":"DEPRECATED: I'm using labstack/echo now.","archived":false,"fork":false,"pushed_at":"2015-12-17T23:30:18.000Z","size":27,"stargazers_count":179,"open_issues_count":2,"forks_count":8,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-09T08:01:34.797Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-17T09:03:40.000Z","updated_at":"2024-12-15T03:58:42.000Z","dependencies_parsed_at":"2022-07-10T05:16:21.238Z","dependency_job_id":null,"html_url":"https://github.com/azer/atlas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/azer/atlas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fatlas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fatlas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fatlas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fatlas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azer","download_url":"https://codeload.github.com/azer/atlas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fatlas/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268538003,"owners_count":24266316,"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-08-03T02:00:12.545Z","response_time":2577,"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":[],"created_at":"2024-12-07T00:18:26.047Z","updated_at":"2025-10-19T06:09:25.338Z","avatar_url":"https://github.com/azer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Atlas\n\nMinimalistic Go Library for Creating JSON API Servers. (Deprecated: [labstack/echo](http://github.com/labstack/echo) is much better)\n\n```go\nimport \"github.com/azer/atlas\"\n\nvar api = atlas.New(atlas.Map{ \"/\": Hello })\n\nfunc Hello(request *atlas.Request) *atlas.Response {\n\treturn atlas.Success(\"Hello World\")\n}\n\napi.Start(\":8080\")\n```\n\nIt'll output the JSON encoding of whatever is returned from request handlers:\n\n```bash\n$ curl localhost:8080\n{ ok: true, result: \"Hello World\" }\n```\n\nJSONP is enabled by default:\n\n```bash\n$ curl localhost:8080?callback=foobar\nfoobar({ ok: true, result: \"Hello World\" })\n```\n\n## Install\n\n```bash\n$ go get github.com/azer/atlas\n```\n\n## Manual\n\nCreate a new API by defining Sinatra-like routes:\n\n```go\nimport \"github.com/azer/atlas\"\n\nvar api = atlas.New(atlas.Map{\n\t\"/user/:name/:surname\": User,\n\t\"/company/:id\": Company,\n\t\"/hello\": Hello,\n})\n```\n\nEvery route points to a function (atlas.Handler) that takes [*atlas.Request](#requests) and returns a `*Response`. Atlas comes with `Success` and `Error` functions that converts anything to a response:\n\n```go\nfunc Hello(request *atlas.Request) *atlas.Response {\n\treturn atlas.Success(\"Hello World\")\n}\n```\n\nYou can start the API by calling `Start` method:\n\n```go\napi.Start(\":8080\")\n```\n\nAtlas will output JSON for you:\n\n```bash\n$ curl http://localhost:8080/hello\n{ ok: true, result: \"Hello World!\" }\n```\n\nIf you leave \"/\" without a handler, Atlas will show a simple API index by default:\n\n```bash\n$ curl http://localhost:8080/\n{\n  \"welcome\": true,\n  \"endpoints\": [\n    \"/company/:id\",\n    \"/hello\",\n    \"/user/:name/:surname\"\n  ]\n}\n```\n\nYou can return structs, maps, etc... Atlas will output them as JSON for you:\n\n```go\ntype Person struct { Name, Surname string }\n\nfunc User(request *atlas.Request) *atlas.Response {\n\treturn atlas.Success(\u0026Person{request.Params[\"name\"], request.Params[\"surname\"]})\n}\n```\n\nRequests to `/user/:name/:surname` will get:\n\n```bash\n$ curl http://localhost:8080/user/john/smith\n{\n  ok: true,\n  result: {\n    Name: \"john\",\n    Surname: \"smith\"\n  }\n}\n```\n\n### JSON Form Posts\n\nTo read JSON form posts easily;\n\n```go\nfunc HelloWorld (request *atlas.Request) *atlas.Response {\n  var data map[string]string\n  err := request.JSONPost(\u0026data)\n  \n  if err != nil {\n    return atlas.Error(500, err)\n  }\n  \n  return atlas.Success(data)\n}\n```\n\n### Using JSON Tags\n\nIf you'd like to modify struct keys for API, here is an example of how to do it:\n\n```go\ntype Person struct {\n  Name string `json:\"name\"`\n  Surname string `json:\"surname\"`\n}\n```\n\n### Error Handling\n\nAtlas also has a handy method to produce errors:\n\n```go\nfunc Company(request *atlas.Request) *atlas.Response {\n\treturn atlas.Error(500, \"Not Implemented Yet\")\n}\n```\n\nWill output:\n\n```bash\n$ curl localhost:8080/company/foobar\n{\n  error: \"Not implemented yet\"\n}\n```\n\nCheckout `examples/` for more info.\n\n## Reference\n\n### atlas.Request\n\nAtlas will pass you its modified version of requests:\n\n```go\ntype Request struct {\n\tHeader map[string][]string\n\tParams urlrouter.Params\n\n\tMethod string\n\tHost   string\n\tURL    *url.URL\n\tGET    bool\n\tPOST   bool\n\n\tBody     io.ReadCloser\n\tForm     url.Values\n\tPostForm url.Values\n\tQuery    url.Values\n}\n```\n\n### atlas.Manual\n\nIf you'd like to structure the entire response, including the wrapper, use `Manual` instead of `Success` or `Error`.\nHere is an example of how to do that:\n\n```go\nfunc Hello(request *atlas.Request) *atlas.Response {\n\treturn atlas.Manual(200, \"Hello World\")\n}\n```\n\n### atlas.API.Listen\n\nTo provide your own net.Listener, call `Listen`:\n\n```go\nlistener, _ := net.Listen(\"tcp\", \"0.0.0.0:6666\")\n\nvar api = atlas.New(atlas.Map{ \"/\": Hello })\napi.Listen(listener)\n```\n\n## Debugging\n\nAtlas uses [debug](http://github.com/azer/debug) for logging. Enable verbose mode by:\n\n```bash\nDEBUG=* go run my server\n```\n\n![](https://i.cloudup.com/8uRNKNk9I2.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fatlas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazer%2Fatlas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fatlas/lists"}