{"id":19086710,"url":"https://github.com/jangbl/node-dependency-injection","last_synced_at":"2026-03-05T20:23:26.994Z","repository":{"id":49845396,"uuid":"265939688","full_name":"jangbl/node-dependency-injection","owner":"jangbl","description":"Express app that uses awilix for dependency injection","archived":false,"fork":false,"pushed_at":"2023-05-13T11:04:48.000Z","size":913,"stargazers_count":43,"open_issues_count":0,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-03T21:37:57.847Z","etag":null,"topics":["awilix","awilix-express","dependency-injection","dependency-injection-container","dependency-injection-framework","inversion","inversion-of-control-container","node","node-dependency-injection"],"latest_commit_sha":null,"homepage":null,"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/jangbl.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":"2020-05-21T19:57:50.000Z","updated_at":"2024-08-10T13:53:57.000Z","dependencies_parsed_at":"2024-10-03T21:37:59.818Z","dependency_job_id":"053f3b18-330d-4381-95a4-f31aa9146151","html_url":"https://github.com/jangbl/node-dependency-injection","commit_stats":null,"previous_names":["jangbl/node-dependency-injection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jangbl%2Fnode-dependency-injection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jangbl%2Fnode-dependency-injection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jangbl%2Fnode-dependency-injection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jangbl%2Fnode-dependency-injection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jangbl","download_url":"https://codeload.github.com/jangbl/node-dependency-injection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223779728,"owners_count":17201287,"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":["awilix","awilix-express","dependency-injection","dependency-injection-container","dependency-injection-framework","inversion","inversion-of-control-container","node","node-dependency-injection"],"created_at":"2024-11-09T03:00:19.284Z","updated_at":"2026-03-05T20:23:21.964Z","avatar_url":"https://github.com/jangbl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dependency Injection in Node with awilix\n\nThis repository contains sample code on how to do dependency injection with the [awilix](https://github.com/jeffijoe/awilix) framework.\n\n\u003ch3 align=\"center\"\u003ePlease help this repo with a ⭐️ if you find it useful! 😁\u003c/h3\u003e\n\nThis repository is part of the [Dependency Injection in Node](https://www.youtube.com/playlist?list=PL1Nml43UBm6ez_JKgCUpgkwfh9oQLjVmm) tutorial series provided by [productioncoder.com](https://productioncoder.com/).\n\n[![Request body validation in Node](images/dependency-injection-in-node.png)](https://www.youtube.com/playlist?list=PL1Nml43UBm6ez_JKgCUpgkwfh9oQLjVmm)\n\nFor updates, please reach out to [@_jgoebel](https://twitter.com/_jgoebel) on Twitter.\n\n# How to run this application\n\n## Running the project\n\n### Install dependencies\n\nMake sure to install the dependencies with `npm`\n\n```\nnpm install\n```\n\n### Running a local Postgres instance\n\nMake sure that you have a local Postgres instance running and that you execute the `SQL` statment in the `migrations` directory.\n\nAfter you have created the tables, make sure that you update the `config/index.js` file with your Postgres configuration (hostname, port, password, etc)\n\n### Starting up the local server\n\nYou can then run the project by executing\n\n```\nnpm run dev\n```\n\n## API\n\n### POST /dev\n\nExpected payload\n\n```\n{\n    \"email\": \"john@example.com\",\n    \"firstName\": \"John\",\n    \"middleNames\": \"Alexander Tom\",\n    \"lastName\": \"Smith\"\n}\n```\n\nThe server will return a `400` bad request error if the request body does not conform to the expected DTO (data transfer object).\n\nThis endpoint will normalize the `firstName` field by truncating the whitespace and by moving all names after the first space to the middle names field.\n\nPlease check out the `./dto` directory to learn more about the expected request body.\n\n### GET /dev/:id\n\n`GET /dev/:id` returns a developer associated with the specified `id`.\nResponse format:\n\n```\n{\n    \"email\": \"john@example.com\",\n    \"firstName\": \"John\",\n    \"middleNames\": \"Alexander Tom\",\n    \"lastName\": \"Smith\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjangbl%2Fnode-dependency-injection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjangbl%2Fnode-dependency-injection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjangbl%2Fnode-dependency-injection/lists"}