-
-
Save uno-de-piera/ed5bb41f0a376a8487d26f7bb24c172e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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