Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

231
Vistas
Express Renders Pug File to Same URL?

When I fill out my form and submit my data, it renders my order.pug file on the browser, but my URL is still showing just localhost:3000 instead of localhost:3000/order?

My pug file is in a views folder and my express.js file is just on the main directory for my project

Here is my express file

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(express.static(__dirname + "/public"));

app.set("view engine", "pug");

app.get("/orderPug", (req, res) => {
  res.render("orderPug");
});

app.get("/", (req, res) => {
  res.sendFile(path.join(__dirname, "index.html"));
});

Then my post request to accept my data, then render my order.pug file

app.post("/create", async (req, res) => {
 //API Authentication code is here

  
  res.render("order")
});

My Pug File looks like this, so if I just navigate to localhost:3000/order it will show the value hard coded like below.

  h1 Total: $#{totalCost}

But after I submit my form data it ends up looking like this, except the URL is still on localhost:3000

  Total: $100.00

So when I submit my form, it shows the page has updated to order.pug yet the URL still just shows localhost:3000 and I don't think that makes sense for a confirmation page to show?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda