Skip to content

Instantly share code, notes, and snippets.

@MichalGniadek
Created December 4, 2023 10:13
Show Gist options
  • Save MichalGniadek/88ec706481e0073c6be86ea102b5e726 to your computer and use it in GitHub Desktop.
Save MichalGniadek/88ec706481e0073c6be86ea102b5e726 to your computer and use it in GitHub Desktop.
// @flow
import express from 'express';
// eslint-disable-next-line prettier/prettier
/*:: import type { $Request, $Response } from 'express';*/
import hazel from 'hazel-server';
const hazelServer = hazel({
// Cache refresh interval (in minutes)
interval: 15,
repository: process.env.HAZEL_REPOSITORY ?? 'comm',
account: process.env.HAZEL_ACCOUNT ?? 'CommE2E',
});
const app = express();
// eslint-disable-next-line prettier/prettier
app.all('*', (req/*:: : $Request*/, res /*:: :$Response*/) => {
hazelServer(req, res);
});
app.listen(parseInt(process.env.HAZEL_PORT, 10) || 80);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment