aboutsummaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/hosted/hosted-astro-project/src/middleware.ts
blob: 1112a3566dcdfd19d50c3f5dcf3afd4ff1cac0ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import https from 'node:https';

export const onRequest = (context, next) => {
	console.info(context.netlify);
	context.locals.middleware = context?.locals?.netlify?.context?.geo?.country?.code ?? null;
	context.locals.runtime = 'Deno' in globalThis ? 'Deno' : 'Node';
	context.locals.title = 'Middleware';
	context.locals.nodePrefixedImportExists = !!https;

	return next();
};