mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 23:12:22 +03:00
23 lines
707 B
JavaScript
23 lines
707 B
JavaScript
const path = require("path");
|
|
|
|
exports.handler =
|
|
/**
|
|
* @param {import('aws-lambda').APIGatewayProxyEvent} event
|
|
* @param {any} context
|
|
*/
|
|
async function (event, context) {
|
|
// event.path
|
|
console.log(JSON.stringify(event));
|
|
// process.chdir(path.join(__dirname, "../../"));
|
|
// process.chdir("../");
|
|
|
|
// const compiledElmPath = path.join(process.cwd(), "elm-pages-cli.js");
|
|
const compiledElmPath = path.join(__dirname, "elm-pages-cli.js");
|
|
const renderer = require("../../../../generator/src/render");
|
|
// console.log("pwd", process.cwd());
|
|
return {
|
|
body: (await renderer(compiledElmPath, event.path, event)).htmlString,
|
|
statusCode: 200,
|
|
};
|
|
};
|