30 lines
879 B
JavaScript
30 lines
879 B
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
|
|
var cors = _interopDefault(require('cors'));
|
|
|
|
// And to throw an error when an error happens in a middleware
|
|
|
|
function initMiddleware(middleware) {
|
|
return function (req, res, options) {
|
|
return new Promise(function (resolve, reject) {
|
|
middleware(options)(req, res, function (result) {
|
|
if (result instanceof Error) {
|
|
return reject(result);
|
|
}
|
|
|
|
return resolve(result);
|
|
});
|
|
});
|
|
};
|
|
} // You can read more about the available options here: https://github.com/expressjs/cors#configuration-options
|
|
|
|
|
|
var NextCors = /*#__PURE__*/initMiddleware(cors);
|
|
|
|
exports.default = NextCors;
|
|
//# sourceMappingURL=nextjs-cors.cjs.development.js.map
|