Frequently Asked Questions

How to apply global interceptors?

You can apply global interceptors for all routes by custom the options.interceptors propert

const main = async () => {
    const app = await HeronJS.create({ module: AppModule });
    await app.listen({
        port: 3000,
        options: {
            interceptors: [ApplyAllControllerInterceptor],
        },
    });
};

How to change the port of http server?

You can change to port by custom the port property. by default the server will start on port 3000

const main = async () => {
    const app = await Heron.create({ module: AppModule });
    await app.listen({
        port: 3000
    });
};

How to create a global error handler?

You can create a global error by custom the options.globalError property.

const main = async () => {
    const app = await Heron.create({ module: AppModule });
    await app.listen({
        port: 3000,
        options: {
            globalError: GlobalErrorInterceptor,
        }
    });
};
 
## How to apply a global uri?
 
```ts
const main = async () => {
    const app = await Heron.create({module: AppModule});
    await app.listen({
        port: 3000,
        options: {
            uri: 'global uri',
        }
    });
};

How to apply express middlewares?

You can apply any Express middlewares by custom the options.middlewares property

const main = async () => {
    const app = await Heron.create({ module: AppModule });
    await app.listen({
        port: 3000,
        options: {
            middlewares: [cors(), helmet()],
        },
    });
};

How can I deploy my application?

To deploy this project in production, we recommend you take a look at Docker and pm2.