{"id":19358644,"url":"https://github.com/jasonlittleton24/node-rest-api-example","last_synced_at":"2026-04-17T04:32:52.781Z","repository":{"id":195685014,"uuid":"345872957","full_name":"jasonlittleton24/Node-Rest-API-example","owner":"jasonlittleton24","description":"An authenticated REST API Example with Node.JS","archived":false,"fork":false,"pushed_at":"2021-03-09T05:02:14.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T23:42:47.422Z","etag":null,"topics":["api","node","rest-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/jasonlittleton24.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,"governance":null}},"created_at":"2021-03-09T03:36:38.000Z","updated_at":"2021-04-08T02:48:47.000Z","dependencies_parsed_at":"2023-09-19T07:34:18.980Z","dependency_job_id":"2e6acf42-b925-4d37-b71c-5673821ad9cd","html_url":"https://github.com/jasonlittleton24/Node-Rest-API-example","commit_stats":null,"previous_names":["jamesmarquez0508/node-rest-api-example","jasonlittleton24/node-rest-api-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jasonlittleton24/Node-Rest-API-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlittleton24%2FNode-Rest-API-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlittleton24%2FNode-Rest-API-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlittleton24%2FNode-Rest-API-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlittleton24%2FNode-Rest-API-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonlittleton24","download_url":"https://codeload.github.com/jasonlittleton24/Node-Rest-API-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlittleton24%2FNode-Rest-API-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31915180,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"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":["api","node","rest-api"],"created_at":"2024-11-10T07:12:33.044Z","updated_at":"2026-04-17T04:32:52.765Z","avatar_url":"https://github.com/jasonlittleton24.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REST JWT Example\n\nThis repository contains an example of authenticated REST API. The REST API was developed using Restify and the authentication method uses [JWT](https://tools.ietf.org/html/rfc7519).\n\n--------------\n\n## Requirements\n\nThis app is not docker based, so you should install Node.js, in order to run the API server.\n\n```\nNode.js \u003e= 10.x\n```\n--------------\n## How to run\n\n1. In the project folder, generate a pair of public and private keys. The pair will be used to sign and verify the JWT token.\n\n```bash\n    openssl genrsa -out secret.key 1024\n    openssl rsa -in secret.key -outform PEM -pubout -out public.key\n```\n\n2. Run `npm install` to install required dependencies for this project;\n\n3. Create .env file and fill in the following env variables:\n```env \n    PORT=8080\n    JWT_AUDIENCE=\u003cYOUR JWT AUDIENCE HERE\u003e\n    JWT_ISSUER=\u003cYOUR JWT ISSUER HERE\u003e\n```\n4. Run API using:\n```bash\n    npm run start\n\n    or\n\n    node index.js\n```\n\n5. Run tests using the following command:\n```bash\n    npm run test\n```\n\n## API Examples\n\n**Sign in route**\n```bash\n    curl --header \"Content-Type: application/json\" \\\n        --request POST \\\n        --data '{\"userId\":1,\"userEmail\": \"your email here\", \"userName\": \"your user name here\"}' \\\n        http://localhost:8080/login/signIn\n```\n**Validate JWT token route**\n```bash\n    curl --header \"Content-Type: application/json\" \\\n        --request POST \\\n        --data '{\"token\": \"your token here\"}' \\\n        http://localhost:8080/login/validateToken\n```\n\n**Public route**\n```bash\n    curl http://localhost:8080/public\n```\n**Private route**\n```bash\n    curl -H \"Authorization: bearer \u003cYOUR_JWT_HERE\u003e\" http://localhost:8080/private\n```\n\n## Further improvements\n\n* Include docker and docker-compose;\n* Add database connection using some ORM or ODM;\n* Include frontend example using a JS library (e.g. React.js). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonlittleton24%2Fnode-rest-api-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonlittleton24%2Fnode-rest-api-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonlittleton24%2Fnode-rest-api-example/lists"}