Plumier application is the entry point of all Plumier based API. Creating Plumier application simply by creating instance of
Plumier class. The simplest Plumier application at least must have
WebApiFacility installed like below.
By default Plumier will search for controllers using this glob pattern
entity (for first class entity). It also automatically detected exported controller in the same file with the entry point file, this is useful for single file project.
Plumier application is configurable using facility, facility is a framework component consist of configurations, ordered middlewares and some micro process before the framework started.
There are list of built-in facility that ready to be used.
|Body parser, CORS middleware, Default dependency resolver|
|Same as |
|Host controllers by path or type, furthermore controllers can be grouped and versioned|
|Simple request logging and error reporting|
|Jwt middleware, Enable authorization, Jwt Secret configuration|
|Mongoose schema generator, generic controller and connection management|
|Provided helper and generic controller for TypeORM|
|Serve static files|
|Serve Swagger UI and generate Open API 3.0 automatically|
|Provide Facebook specific social login functionalities|
|Provide Google specific social login functionalities|
|Provide GitHub specific social login functionalities|
|Provide GitLab specific social login functionalities|
|Provide Twitter specific social login functionalities|
listen method called immediately its make Plumier lost its ability for testing purpose. To do that you can use
initialize method to get a testable server like below.
By using code above, you can test your API using supertest like below.