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

230
Views
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
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!