A little demo API that implements Inversion of Control (IoC) using InversifyJS and Typescript.
$ npm install
Run the API with the following command:
$ npm run start
Create a new post
curl --location --request POST 'http://localhost:3000/api/posts' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Proof of Concept",
"description": "Here goes the description of my new post."
}'
Get the posts list
curl --location --request GET 'http://localhost:3000/api/posts'
Added a few changes to improve this project:
- Removed dummy endpoint and implemented a new one using
POST
and handling a basic payload. - Split the project into layers for a better structure.
- Added inversify-express-utils to implement new API endpoints.
- Added Unit Tests.
This repo is related to my article on Medium about the Inversion of Control principle and InversifyJS.
Alejandro Marr