{"id":21524049,"url":"https://github.com/helloakn/node-multi-authorizer-jwt","last_synced_at":"2025-04-09T22:51:21.938Z","repository":{"id":111313106,"uuid":"487071444","full_name":"helloakn/node-multi-authorizer-jwt","owner":"helloakn","description":"Multiple Authorizers in NodeJs JWT","archived":false,"fork":false,"pushed_at":"2022-05-02T04:03:33.000Z","size":1109,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T22:51:14.164Z","etag":null,"topics":["authorizers","express","jwt","multi-auth","nodejs","sqlite3"],"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/helloakn.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-29T18:20:33.000Z","updated_at":"2023-06-30T02:34:21.000Z","dependencies_parsed_at":"2023-05-23T08:15:33.913Z","dependency_job_id":null,"html_url":"https://github.com/helloakn/node-multi-authorizer-jwt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloakn%2Fnode-multi-authorizer-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloakn%2Fnode-multi-authorizer-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloakn%2Fnode-multi-authorizer-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloakn%2Fnode-multi-authorizer-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helloakn","download_url":"https://codeload.github.com/helloakn/node-multi-authorizer-jwt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125643,"owners_count":21051766,"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":["authorizers","express","jwt","multi-auth","nodejs","sqlite3"],"created_at":"2024-11-24T01:20:27.635Z","updated_at":"2025-04-09T22:51:21.924Z","avatar_url":"https://github.com/helloakn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multiple Authorizer in Nodejs JWT\nThis is for coding test.  \nMultiple Authorization in Nodejs JWT\n\n[![NodeJs](https://img.shields.io/badge/nodejs-v16.14.2-green)](https://github.com/helloakn/node-multi-authorizer-jwt) \n[![NPM](https://img.shields.io/badge/npm-v8.5.0-green)](https://github.com/helloakn/node-multi-authorizer-jwt) \n[![Express](https://img.shields.io/badge/express-v^4.17.3-green)](https://github.com/helloakn/node-multi-authorizer-jwt) \n[![Language](https://img.shields.io/badge/dynamic/json?color=blueviolet\u0026label=Language\u0026query=language\u0026url=https%3A%2F%2Fapi.github.com%2Frepos%2Fhelloakn%2Fnode-multi-authorizer-jwt)](https://github.com/helloakn/node-multi-authorizer-jwt)\n[![Star Count](https://img.shields.io/badge/dynamic/json?color=brightgreen\u0026label=Star\u0026query=stargazers_count\u0026url=https%3A%2F%2Fapi.github.com%2Frepos%2Fhelloakn%2Fnode-multi-authorizer-jwt)](https://github.com/helloakn/node-multi-authorizer-jwt)\n\n\n## Table of Contents\n- File Structure\n- npm Dependences\n- How to Install\n- How to Run\n- How to Test\n- Swagger\n- Acknowledgement\n\n### File Structure\nStructure is base on lambda functions.  \nSo we can easily deploy to lambda or ECS or EC2 as the monolith or microservice.  \nWe can separate authorizer and functions too.  \nAll the services on our code would be functions in Lambda and middleware will be lambda Authorizer as well as all the others are the layers.\n```nth\n.\n├── data                        # dir for sqlite3 database\n|   └── codetest.sqlite3        # sqlite3 db file\n├── resources                   # for documentations resources\n│   └── ...\n├── sc                          # nodejs source code\n│   ├── authorizers             # administrator and customer middlewares\n│   │   └── ...                 \n│   ├── common                  # for the common functions\n│   │   └── ...\n│   ├── lib                     # just for system configuration files\n│   │   └── ...\n│   ├── models                  # tables\n│   │   └── ...\n│   ├── routes                  # urls and prefixs\n│   │   └── ...\n│   └── services                # Controllers , we can deploy them to AWS Lambda functions\n│       ├── admin               # For all admin functions\n│       │   └── ...\n│       └── user                # For all user functions\n│           └── ...\n├── tests                       # api test\n│   └── ...\n├── README.md              \n└── ...\n```\n### npm Dependences\n\n* [cors](https://www.npmjs.com/package/cors) ^2.8.5 - for api cors allown and deny\n* [dotenv](https://www.npmjs.com/package/dotenv) ^16.0.0 - to load environment variable from .env file or sys environment variable\n* [express](https://www.npmjs.com/package/express) ^4.18.1 - for web app\n* [sqlite3](https://www.npmjs.com/package/sqlite3)  ^5.0.6 - to use as local storage  \n* [md5](https://www.npmjs.com/package/md5)  ^2.3.0 - for one way password hex \n* [jsonwebtoken](https://www.npmjs.com/package/jsonwebtoken)  ^8.5.1 - JWT  \n* [swagger-jsdoc](https://www.npmjs.com/package/swagger-jsdoc)  ^6.2.1 - for api doc \n* [swagger-ui-express](https://www.npmjs.com/package/swagger-ui-express)  ^4.3.0 - express api doc\n* [jest](https://www.npmjs.com/package/jest)  ^28.0.3 - for unit testing\n* [supertest](https://www.npmjs.com/package/supertest)  ^6.2.3 - for api testing \n\n### How to install\nWe have to install npm dependence to run our program smoothly. pls follow as the singlie line of  the following command.\n```shell\nnpm install\n```\n![alt text](resources/install.png)  \n\n## How to Run\nConfiguration is just for dev(local) only. we can easily execute our program in local as the following command.\n```shell\nnpm run dev\n```\n## How to Test\nI use jest and supertest npm package for testing. main program is base on commajs and jest is base on model type. however we can run and test our program because i have configured in package.json. You can check the testing source code in [./test](https://github.com/helloakn/node-multi-authorizer-jwt/tree/main/tests) directory too. \nHere is the command to run the testing.\n```shell\nnpm test\n```\n![alt text](resources/test.png)  \n\n## Swagger\nwe can reach to our swagger from this link...  \n[Link](http://localhost:9999/swagger/)  API Doc swagger -\u003e http://localhost:9999/swagger/ \nWe can test the api ourselves.\n\n![alt text](resources/swagger.png) \n\n## Acknowledgement\nThank you all for giving me a chance to answer the coding test.  \nI'm looking forward to work with you and I could make a promise that \" I would do my best \".","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelloakn%2Fnode-multi-authorizer-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelloakn%2Fnode-multi-authorizer-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelloakn%2Fnode-multi-authorizer-jwt/lists"}