Poq.SDK.Node

Home > @poq/nestjs-proxy > ProxyModule

ProxyModule class

Proxy module helps to set default configuration for proxy handler.

Signature:

export declare class ProxyModule 

Example

@Module({
 import: [
   ProxyModule.forRoot({
     target: 'https://poq.platform.io',
     routes: [{
       // Original path is used.
       // Defines proxy for all methods: post/put/delete/options/get ...
       path: '/proxy_path_one',
     }, {
       // Defines proxy for all methods: post/put/delete/options/get ...
       path: '/proxy_path_two',
       target: '/custom_target'
     }, {
       path: '/proxy_path_two',
       target: '/custom_target',
       verb: [HttpVerb.Get, HttpVerb.Post]
     }]
   })
 ]
})
class AppModule implements OnModuleInit {}

Methods

Method Modifiers Description
forRoot(options) static Method represents the conventional way to register dynamic module in nestjs.