scopsy/node-typescript-starter

How to setup cors

ShareinSK opened this issue · 1 comments

Hi,

Where should I setup the cors option?

Thanks

@ShareinSK you have to install cors from npm

npm install --save cors

after that you should add use to app.ts in $onMountingMiddlewares() hook

public async $onMountingMiddlewares(): Promise<any> {
        this
            .use(GlobalAcceptMimesMiddleware)
            .use(cors({
                origin: '*'
            }));

        return null;
    }