Skip to content

Releases: inversify/inversify-express-utils

5.2.1

25 Jan 00:28
85d9a9d
Compare
Choose a tag to compare
Update package.json

5.2.0

16 Dec 13:24
01448b5
Compare
Choose a tag to compare
Issue 590 (#97)

* Added test case

* WIP implementation

* Implemented issue 590

5.1.2

07 Dec 02:22
9dc3948
Compare
Choose a tag to compare
Fixed issues when no pram metadata is available (#90)

5.1.1

07 Dec 00:49
c610ba7
Compare
Choose a tag to compare
improved docs (#89)

5.1.0

07 Dec 00:30
992ebd8
Compare
Choose a tag to compare
Implemented route map util (#88)

* Implemented route map util

* Renamed path

* lock dep

5.0.0

26 Nov 10:42
b2fb762
Compare
Choose a tag to compare

New features

  • Reduced amount of required boilerplate code:

    • The @injectable annotation is no longer required in classes annotated with @controller.
    • Declaring bindings is no longer required in classes annotated with @controller.
  • Support for HttpContext:

    • The current HttpContext can be accessed from a controller that extends the BaseHttpController class or that gets it injected using the @injectHttpContext decorator.
    • The current HttpContext can be accessed from middleware that extends the BaseMiddleware class.
  • Support for BaseMiddleware. Extending BaseMiddleware allow us to inject dependencies into a middleware function. Extending BaseMiddleware also allows us to access the current HttpContext from a middleware function.

  • Support for AuthProvider. If you provide an implementation of AuthProvider, you will be able to access the current user via the current HttpContext.

Breaking changes

  • The @injectable annotation is no longer required in classes annotated with @controller.
  • Declaring bindings is no longer required in classes annotated with @controller.

⚠️ Declaring a binding is not required for Controllers but it is required to import the controller one unique time. When the controller file is imported (e.g. import "./controllers/some_controller") the class is declared and the metadata is generated. If you don't import it the metadata is never generated and therefore the controller is not found. An example of this can be found here.

If you run the application multiple times within a shared runtime process (e.g. unit testing) you might need to clean up the existing metadata before each test.

import { cleanUpMetadata } from "inversify-express-utils";

describe("Some Component", () => {

    beforeEach(() => {
        cleanUpMetadata();
    });

    it("Some test case", () => {
        // ...
    });

});

You can find an example of this in our unit tests.

5.0.0-beta.1

23 Nov 02:08
32a0caa
Compare
Choose a tag to compare
5.0.0-beta.1 Pre-release
Pre-release

Breaking change

  • The @injectable annotation is no longer required in classes annotated with @controller.
  • Declaring bindings is no longer required in classes annotated with @controller.

⚠️ Note: declaring a binding is not required for Controllers but it is required to import the controller at least once. When the controller file is imported (e.g. import "./controllers/some_controller") the class is declared and the metadata is generated. If you don't import it the metadata is never generated and therefore the controller is not found.

  • If you run the application multiple times within a shared runtime process (e.g. unit testing) you might need to clean up the existing metadata before each test.
import { cleanUpMetadata } from "inversify-express-utils";

describe("Integration Tests:", () => {

    beforeEach((done) => {
        cleanUpMetadata();
        container = new Container();
        done();
    });

    describe("Routing & Request Handling:", () => {

        it("should work for async controller methods", (done) => {
            // ...
           done();
        });

    });

});

You can find an example of this in our unit tests.

An example of migration can be found at inversify/inversify-express-example#257.

4.2.2

11 Nov 02:20
0cce065
Compare
Choose a tag to compare
Fixed path issue (#74)

4.2.1

11 Nov 02:05
ecf6ed3
Compare
Choose a tag to compare

4.2.0

11 Nov 01:48
355fae5
Compare
Choose a tag to compare
  • Implemented HttpContext support