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

179
Views
Quiero usar un archivo html como mi página de inicio en next.js

Cuando alguien visita mi directorio raíz "https://example.com/", quiero mostrar un archivo .html normal. (index.html) ¿Cómo puedo hacer eso con next.js?

Investigué y edité mi archivo de configuración de esta manera,

 /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, rewrites: async () => { return [ { source: "/public/myfile.html", destination: "/pages/api/myfile.js", }, ]; }, };

/pages/api/miArchivo.js

 import fs from "fs"; const filename = "/index.html"; export default async function api(req, res) { res.setHeader("Content-Type", "text/html; charset=utf-8"); res.write(await fs.readFileSync(filename, "utf-8")); res.end(); } module.exports = nextConfig;

pero este archivo de configuración muestra mi página .html justo cuando llego a esta URL: https://example.com/index.html

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 rewrites: async () => [ { source: "/", destination: "/index.html", }, ],

agregué esto en mi archivo next.config.js (en el objeto nextConfig)

Tengo un archivo index.html en mi directorio /public.

about 4 years ago · Juan Pablo Isaza Report
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!