Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created Jun 12, 2020
Embed
What would you like to do?
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