Skip to content

Instantly share code, notes, and snippets.

View culttm's full-sized avatar
🇺🇦

Dmytro Kozlov culttm

🇺🇦
View GitHub Profile
map $sent_http_content_type $expires {
"text/html" epoch;
"text/html; charset=utf-8" epoch;
default off;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
@epicbytes
epicbytes / example.api.ts
Last active January 20, 2025 20:45
NextJS Authorization Files
/*** function that used as middleware ***/
accessToken: async (name) => {
if (typeof document === "undefined") return "";
let token = document.cookie
.split(";")
.filter((cookie) => cookie.startsWith("token"))[0];
if (!token) {
const response = await fetch("/api/refresh", { method: "POST" });