Merge pull request #4 from DorianNiemiecSVRJS/main

Force APIs to use SSR instead of static generation
This commit is contained in:
Abhijit Bhattacharjee 2024-06-22 15:56:11 +05:30 committed by GitHub
commit a4ae47b283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 24 additions and 0 deletions

View file

@ -1,6 +1,9 @@
import { NextRequest, NextResponse } from "next/server";
import clientPromise from "@/lib/db";
// Force the API to use SSR instead of static generation
export const dynamic = "force-dynamic";
// Handler for GET requests
export async function GET(req: NextRequest) {
try {

View file

@ -1,6 +1,9 @@
import { NextRequest, NextResponse } from "next/server";
import { serialize } from "cookie";
// Force the API to use SSR instead of static generation
export const dynamic = "force-dynamic";
export async function POST(request: NextRequest) {
const { username, password } = await request.json();

View file

@ -1,6 +1,9 @@
import { NextRequest, NextResponse } from "next/server";
import clientPromise from "@/lib/db";
// Force the API to use SSR instead of static generation
export const dynamic = "force-dynamic";
// Handler for GET requests
export async function GET(req: NextRequest) {
try {

View file

@ -1,6 +1,9 @@
import { NextRequest, NextResponse } from "next/server";
import clientPromise from "@/lib/db";
// Force the API to use SSR instead of static generation
export const dynamic = "force-dynamic";
// Handler for GET requests
export async function GET(req: NextRequest) {
try {

View file

@ -1,6 +1,9 @@
import { NextResponse } from "next/server";
import clientPromise from "@/lib/db";
// Force the API to use SSR instead of static generation
export const dynamic = "force-dynamic";
export async function POST(request: Request) {
const body = await request.json();
const { fileName, version, downloadLink, fileSize } = body;

View file

@ -1,6 +1,9 @@
import { NextResponse } from "next/server";
import clientPromise from "@/lib/db";
// Force the API to use SSR instead of static generation
export const dynamic = "force-dynamic";
export async function POST(request: Request) {
const body = await request.json();
const { fileName, version, downloadLink, fileSize } = body;

View file

@ -1,6 +1,9 @@
import { NextResponse } from "next/server";
import clientPromise from "@/lib/db";
// Force the API to use SSR instead of static generation
export const dynamic = "force-dynamic";
export async function POST(request: Request) {
const body = await request.json();
const { fileName, version, downloadLink, fileSize } = body;

View file

@ -1,6 +1,9 @@
import { createRouteHandler } from "uploadthing/next";
import { ourFileRouter } from "./core";
// Force the API to use SSR instead of static generation
export const dynamic = "force-dynamic";
export const { GET, POST } = createRouteHandler({
router: ourFileRouter,
});