Force APIs to use SSR instead of static generation
This commit is contained in:
parent
e76b69b345
commit
eaf74b903c
8 changed files with 24 additions and 0 deletions
|
@ -1,6 +1,9 @@
|
||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import clientPromise from "@/lib/db";
|
import clientPromise from "@/lib/db";
|
||||||
|
|
||||||
|
// Force the API to use SSR instead of static generation
|
||||||
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
// Handler for GET requests
|
// Handler for GET requests
|
||||||
export async function GET(req: NextRequest) {
|
export async function GET(req: NextRequest) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import { serialize } from "cookie";
|
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) {
|
export async function POST(request: NextRequest) {
|
||||||
const { username, password } = await request.json();
|
const { username, password } = await request.json();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import clientPromise from "@/lib/db";
|
import clientPromise from "@/lib/db";
|
||||||
|
|
||||||
|
// Force the API to use SSR instead of static generation
|
||||||
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
// Handler for GET requests
|
// Handler for GET requests
|
||||||
export async function GET(req: NextRequest) {
|
export async function GET(req: NextRequest) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import clientPromise from "@/lib/db";
|
import clientPromise from "@/lib/db";
|
||||||
|
|
||||||
|
// Force the API to use SSR instead of static generation
|
||||||
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
// Handler for GET requests
|
// Handler for GET requests
|
||||||
export async function GET(req: NextRequest) {
|
export async function GET(req: NextRequest) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import clientPromise from "@/lib/db";
|
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) {
|
export async function POST(request: Request) {
|
||||||
const body = await request.json();
|
const body = await request.json();
|
||||||
const { fileName, version, downloadLink, fileSize } = body;
|
const { fileName, version, downloadLink, fileSize } = body;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import clientPromise from "@/lib/db";
|
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) {
|
export async function POST(request: Request) {
|
||||||
const body = await request.json();
|
const body = await request.json();
|
||||||
const { fileName, version, downloadLink, fileSize } = body;
|
const { fileName, version, downloadLink, fileSize } = body;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import clientPromise from "@/lib/db";
|
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) {
|
export async function POST(request: Request) {
|
||||||
const body = await request.json();
|
const body = await request.json();
|
||||||
const { fileName, version, downloadLink, fileSize } = body;
|
const { fileName, version, downloadLink, fileSize } = body;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { createRouteHandler } from "uploadthing/next";
|
import { createRouteHandler } from "uploadthing/next";
|
||||||
import { ourFileRouter } from "./core";
|
import { ourFileRouter } from "./core";
|
||||||
|
|
||||||
|
// Force the API to use SSR instead of static generation
|
||||||
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
export const { GET, POST } = createRouteHandler({
|
export const { GET, POST } = createRouteHandler({
|
||||||
router: ourFileRouter,
|
router: ourFileRouter,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue