Skip to main content

HTTP Framework Compatibility

Podium is HTTP framework agnostic with first class support for Express.

In practise core Podium works with the standard http.Server module in Node.js, but the core modules also come with Express compatible middleware methods for ease of use.

Since Podium is built for the http.Server module in Node.js, it's pretty straight forward to get Podium to work with most HTTP frameworks.

The Podium team support Fastify via plugins.

Example of setting up a podlet server in all HTTP frameworks supported by the Podium team:

import express from 'express';
import Podlet, { html } from '@podium/podlet';

const app = express();

const podlet = new Podlet({
name: 'myPodlet',
version: '1.0.0',
pathname: '/',
development: true,
});

app.use(podlet.middleware());

app.get(podlet.content(), (req, res) => {
if (res.locals.podium.context.locale === 'nb-NO') {
return res.status(200).podiumSend(html`<h2>Hei verden</h2>`);
}
res.status(200).podiumSend(html`<h2>Hello world</h2>`);
});

app.get(podlet.manifest(), (req, res) => {
res.status(200).json(podlet);
});

app.listen(7100);