Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created June 12, 2020 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/ed5bb41f0a376a8487d26f7bb24c172e to your computer and use it in GitHub Desktop.
Save uno-de-piera/ed5bb41f0a376a8487d26f7bb24c172e to your computer and use it in GitHub Desktop.
import { App, ViewRenderConfig } from "https://deno.land/x/alosaur/mod.ts";
import { Handlebars } from 'https://deno.land/x/handlebars/mod.ts';
import { HomeArea } from "./areas/home/HomeArea.ts";
const app = new App({
areas: [HomeArea],
})
// Basedir path
const viewPath = 'views';
// Create Handlebars config
const handle = new Handlebars({
baseDir: viewPath,
extname: '.hbs',
layoutsDir: 'layouts/',
partialsDir: 'partials/',
defaultLayout: 'main',
helpers: undefined,
compilerOptions: undefined,
});
app.useViewRender({
type: 'handlebars',
basePath: viewPath,
getBody: async (path: string, model: any, config: ViewRenderConfig) => await handle.renderView(path, model),
});
app.useStatic({
root: 'statics',
baseRoute: '/statics/',
});
app.listen(":5000");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment