Close to giving up getting started #197
-
I can't get this little library to work. I'm new to JS/TS and Deno, but even so, there's not much I can get wrong! I got the Anyway, these are my two attempts and their results. Deno with oak:
The result is "Login with" blank. The My next try was to use
I'm probably doing something obviously dumb. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey! Your first example is nearly correct. The issue is that Eta doesn't know where the files are (even though it tries a bunch of paths). You can either configure Eta beforehand using This should work (assuming the async function handleGetLoginGoogleViaEta(context) {
const viewData = { title: "Squashed | Login", loginProviderName: "Google" };
const html = await eta.renderFile("log.eta", viewData, {
views: './',
});
console.log(html)
} I prefer to configure it beforehand: eta.configure({
views: './',
})
async function handleGetLoginGoogleViaEta(context) {
const viewData = { title: "Squashed | Login", loginProviderName: "Google" };
const html = await eta.renderFileAsync("log.eta", viewData);
console.log(html)
} Also, to print out something, you need to use the output tag-type Example:
|
Beta Was this translation helpful? Give feedback.
Hey! Your first example is nearly correct. The issue is that Eta doesn't know where the files are (even though it tries a bunch of paths). You can either configure Eta beforehand using
eta.configure()
or supply a config object when callingrenderFile
. Take note thatrenderFile
returnsvoid
IF you supply a callback function, if not it always returns a promise that resolves as the HTML (string), so no need for a type check.This should work (assuming the
login-oauth-google.eta
file is in the same folder as index.js):