{"id":19388874,"url":"https://github.com/james2doyle/serverjs-jwt-example","last_synced_at":"2026-05-12T23:05:24.908Z","repository":{"id":145775601,"uuid":"110647292","full_name":"james2doyle/serverjs-jwt-example","owner":"james2doyle","description":"An example on how to use Server.js with JWT authentication","archived":false,"fork":false,"pushed_at":"2018-11-18T21:48:29.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-24T19:59:58.903Z","etag":null,"topics":["authentication","jwt","nodejs","serverjs"],"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/james2doyle.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-11-14T05:59:08.000Z","updated_at":"2018-11-18T21:48:31.000Z","dependencies_parsed_at":"2023-03-25T23:47:32.331Z","dependency_job_id":null,"html_url":"https://github.com/james2doyle/serverjs-jwt-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/james2doyle/serverjs-jwt-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fserverjs-jwt-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fserverjs-jwt-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fserverjs-jwt-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fserverjs-jwt-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/james2doyle","download_url":"https://codeload.github.com/james2doyle/serverjs-jwt-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fserverjs-jwt-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32960336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T09:19:52.626Z","status":"ssl_error","status_checked_at":"2026-05-12T09:17:33.438Z","response_time":102,"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":["authentication","jwt","nodejs","serverjs"],"created_at":"2024-11-10T10:13:55.534Z","updated_at":"2026-05-12T23:05:24.890Z","avatar_url":"https://github.com/james2doyle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Server.js JWT Example\n=====================\n\n\u003e An example on how to use [Server.js](https://serverjs.io/) with JWT authentication.\n\n## Quick Start\n\n* `npm install`\n* copy `example-config.js` to `config.js`\n* update `config.js` with the correct details\n* `npm start`\n\n## Setup\n\n#### Home Route\n\nThe default page is unauthenticated by default. And returns a simple login form that shows how the login works.\n\n#### Authenticating a user\n\n```\nPOST http://localhost:3000/login\n\n{\n    \"username\": \"john.doe\",\n    \"password\": \"foobar\"\n}\n```\n\nThis will return the token as an object:\n\n```\n{\n    \"token\": \"some.crazy.string\"\n}\n```\n\nYou can then access protected routes behind the authentication middleware:\n\n```\nGET http://localhost:3000/protected\n\n{\n    message: 'hello! thanks for the token',\n    user: {\n        id: 123,\n        email: 'admin@admin.com',\n        first_name: 'Admin',\n        last_name: 'Account',\n    },\n}\n```\n\n### Coding style\n\nAirbnb has an excellent [style guide](https://github.com/airbnb/javascript) for ES6. We will follow the guide and adhere to the recommended coding style.\n\n### ESLint\n\nWe will use ESLint with Airbnb style and pre-parse our code to detect violations of the style.\n\n## Commands\n\n### Run\n\n```\nnpm start\n```\n\n## License\n\n  [MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames2doyle%2Fserverjs-jwt-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjames2doyle%2Fserverjs-jwt-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames2doyle%2Fserverjs-jwt-example/lists"}