You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Next.js 14调用API路由时出现404错误,急求解决方案

Next.js App Router API路由/api/hello/返回404错误,新建项目仍无法解决

我尝试解决调用/api/hello/这类API路由时出现的404错误,已经搜索了相关文章、YouTube视频,甚至查阅了Next.js官方文档,但都没找到解决办法。我从零新建了一个项目,问题依然存在。

以下是app/api/hello/router.ts的代码:

import { NextResponse, NextRequest } from "next/server";

export async function GET(request: NextRequest) {
  return NextResponse.json({
    messsage: "hello world",
  });
}

急需解决这个问题的帮助。

内容的提问来源于stack exchange,提问作者Eyad Farah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 21:27:34