Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

331
Views
Next.js API Routes obtiene el resultado 404 no encontrado cuando se implementa en el servidor

He usado la siguiente guía para implementar en el servidor:

https://steveholgado.com/nginx-for-nextjs/

Los enrutadores API funcionan bien en cartero y comienzan localmente con el comando "próximo inicio" o "próximo inicio-local" .

Estructura de carpetas:

 Pages ---api/ ------/redirect ---------------/index.js ---home

este es mi código next.config.js:

 require("dotenv").config(); const webpack = require("webpack"); const withPlugins = require("next-compose-plugins"); const withCss = require("@zeit/next-css"); let pathBaseDomain = process.env.API_URL_OTP; if (process.env.NODE_ENV === "production") { if (typeof window !== "undefined") { pathBaseDomain = window._env_.API_URL_OTP; } else { pathBaseDomain = process.env.API_URL_OTP; } } const nextConfig = { // target: "serverless", webpack(config) { config.module.rules.push({ test: /\.(png|svg|eot|otf|ttf|woff|woff2|gif)$/, use: { loader: "url-loader", options: { limit: 8192, publicPath: "/_next/static/", outputPath: "static/", name: "[name].[ext]" } } }); config.plugins.push(new webpack.EnvironmentPlugin(process.env)); return config; }, assetPrefix: process.env.NODE_ENV === 'production' ? pathBaseDomain : '', publicRuntimeConfig: { basePath:process.env.NODE_ENV === 'production' ? pathBaseDomain : '', }, }; module.exports = withPlugins([[withCss]], nextConfig);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!