DenoDDeno
Powered by
leftdevL
Denoβ€’3y agoβ€’
2 replies
leftdev

Bunle OAK static assets to the compiled binary

Hi, I am currently switching from NodeJS to Deno, and so far so good!
One of the reasons for this switch is how easily i can compile everyting up in one executable, which is important for my use case.

However, I'm not familiar with OAK and how it integrates, as i come from Express. I have the current code, which runs fine on the CLI, but doesn't serve the assets once compiled:
// ...imports
app.use(async (context, next) => {
  try {
    await context.send({
      root: `${Deno.cwd()}/src/www/public`,
      index: 'login.html',
    });
  } catch {
    await next();
  }
});
/// ...listen
// ...imports
app.use(async (context, next) => {
  try {
    await context.send({
      root: `${Deno.cwd()}/src/www/public`,
      index: 'login.html',
    });
  } catch {
    await next();
  }
});
/// ...listen

Is this something that is supported? Is there any way to bundle assets inside the executable? I've seen the Leaf library, but i wouldn't know how to integrate it in this scenario

thanks
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

How to get the path to the compiled binary?
QuantumQQuantum / help
3y ago
Deno Oak doesnt work when compiled to `.exe`
babakfpBbabakfp / help
2y ago
Compiled app binary.rs main thread panicked
NeubekiNNeubeki / help
2y ago