hapi-cors
Enables cors for a hapijs app based on config.
Default Options:
origins: '*' allowCredentials: 'true' exposeHeaders: 'content-type' 'content-length' maxAge: 600 methods: 'POST, GET, OPTIONS' headers: 'Accept' 'Content-Type' 'Authorization'
Using an origins array:
'use strict' const Hapi = ; const server = Hapi; server; const start = { try await server await serverstart; catcherr console; process; }; ;
Using a function:
'use strict' const Hapi = ; const server = Hapi; server; const checkOrigin = { iforigin === 'http://localhost:3000' return true else return false } const start = { try await server await serverstart; catcherr console; process; }; ;