{"id":40033120,"url":"https://github.com/supermamon/node-restify-jwt-sample","last_synced_at":"2026-01-19T04:31:29.699Z","repository":{"id":25248594,"uuid":"103551975","full_name":"supermamon/node-restify-jwt-sample","owner":"supermamon","description":"A sample restify api service with JWT authentication","archived":false,"fork":false,"pushed_at":"2024-12-11T00:02:04.000Z","size":1112,"stargazers_count":17,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-11T00:29:41.412Z","etag":null,"topics":["api","jwt","node","restify"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/supermamon.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":"2017-09-14T15:50:39.000Z","updated_at":"2024-12-11T00:02:03.000Z","dependencies_parsed_at":"2024-06-17T12:04:04.520Z","dependency_job_id":"5386aa2f-1545-417b-b474-25f36286af2b","html_url":"https://github.com/supermamon/node-restify-jwt-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/supermamon/node-restify-jwt-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supermamon%2Fnode-restify-jwt-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supermamon%2Fnode-restify-jwt-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supermamon%2Fnode-restify-jwt-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supermamon%2Fnode-restify-jwt-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supermamon","download_url":"https://codeload.github.com/supermamon/node-restify-jwt-sample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supermamon%2Fnode-restify-jwt-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28561839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","jwt","node","restify"],"created_at":"2026-01-19T04:31:29.242Z","updated_at":"2026-01-19T04:31:29.695Z","avatar_url":"https://github.com/supermamon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-restify-jwt-sample\n\nA sample api service with JWT authentication\n\n## What's Inside\n\n* route path prefix\n* versioned routes\n* protected/unprotected routes\n* registration\n* admin/non-admin routes\n* logging (using winston)\n* unit tests\n\n## Configure\n\nSee `/config/index.js`\n\n## Examples\n\nUse `api/register` to generate tokens.\n\n```sh\n$ curl -X POST \\\n\u003e -H \"Content-Type: application/json\" \\\n\u003e --data '{ \"name\": \"Johnny Appleseed\", \"role\": \"test\", \"password\":\"some-hashed-password\" }' \\\nhttp://localhost:8080/api/register\n\n{\"name\":\"Johnny Appleseed\",\"role\":\"test\",\"token\":\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9obm55IEFwcGxlc2VlZCIsInJvbGUiOiJ0ZXN0IiwiaWF0IjoxNTA5MDc2MTEwfQ.EsRsidT33amgeDX8u6SlE6LwWUs2jpyblogOvLaJ1Y8\"}\n\n$ curl -X POST \\\n\u003e -H \"Content-Type: application/json\" \\\n\u003e --data '{ \"name\": \"Tim Cook\", \"role\": \"admin\", \"password\":\"some-hashed-password\" }' \\\nhttp://localhost:8080/api/register\n\n{\"name\":\"Tim Cook\",\"role\":\"admin\",\"token\":\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiVGltIENvb2siLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE1MDkwNzY0NzB9.f5_v9HfOAiOS4IiiQ5Pj0IxLOMJGWUhHQ57Zd9opqwE\"}\n\n```\n\nRoute protection\n\n```sh\n$ curl localhost:8080/api/ping\n{\"ping\":\"OK\"}\n\n$ curl localhost:8080/api/home\n{\"code\":\"InvalidCredentials\",\"message\":\"No authorization token was found\"}\n```\n\nProtected route\n\n```sh\n$ curl -H \"Authorization: Bearer your-token\" localhost:8080/api/home\n{\"welcome\":\"Johnny Appleseed\"}\n\n```\n\nAdmin route\n\n```sh\n$ curl -H \"Authorization: Bearer admin-token\" localhost:8080/api/admin\n{\"action\":\"completed\"}\n\n$ curl -H \"Authorization: Bearer user-token\" localhost:8080/api/admin\n{\"code\":\"Forbidden\",\"message\":\"You don't have sufficient priviledges.\"}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupermamon%2Fnode-restify-jwt-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupermamon%2Fnode-restify-jwt-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupermamon%2Fnode-restify-jwt-sample/lists"}