Skip to content

Instantly share code, notes, and snippets.

@bjerkek
Last active May 4, 2021 12:17
Show Gist options
  • Save bjerkek/0f40e9b20b83bca997b2f6df874e456c to your computer and use it in GitHub Desktop.
Save bjerkek/0f40e9b20b83bca997b2f6df874e456c to your computer and use it in GitHub Desktop.
Learning Podium - Loans Layout - 1
const express = require('express');
const Layout = require('@podium/layout');
const app = express();
const domain = 'http://localhost';
const port = '7000';
const url = `${domain}:${port}`;
const layout = new Layout({
name: 'loansLayout',
pathname: '/loans',
});
const headerPodlet = layout.client.register({
name: 'headerPodlet',
uri: 'http://localhost:7100/manifest.json',
});
app.use(layout.middleware());
app.get('/loans', async (req, res) => {
const incoming = res.locals.podium;
const content = await headerPodlet.fetch(incoming);
incoming.view.title = 'Loans';
res.podiumSend(`<div>${content}</div>`);
});
app.listen(port, () => {
console.log(url);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment