"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = void 0;
function nextFlightActionEntryLoader() {
    const { actionPath , actionName  } = this.getOptions();
    return `
import { ${actionName} } from ${JSON.stringify(actionPath)}
export default async function endpoint(req, res) {
  try {
    const result = await ${actionName}()
    const serializedResult = JSON.stringify(result)
    res.statusCode = 200
    res.setHeader('Content-Type', 'text/plain')
    res.body(serializedResult)
  } catch (err) {
    res.statusCode = 500
    res.setHeader('Content-Type', 'text/plain')
    res.body(err.message)
  }
  res.send()
}`;
}
var _default = nextFlightActionEntryLoader;
exports.default = _default;

//# sourceMappingURL=next-flight-action-entry-loader.js.map