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

177
Views
ejs won't render Html page

I'm using Express with EJS to render the response from a database query as an simple Html page. in dev tools shows an error

"Access to fetch at 'https://o189131.ingest.sentry.io/api/5478725/envelope/?sentry_key=504fcb6b9eee411d8157d41c0adb1170&sentry_version=7' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."

And it doesn't render Html page, I want to use keep the extension of ejs file like home.html instead of using home.ejs.html in visual studio but I cant, why?

const express = require('express')
const app = express()

app.set('view engine', 'ejs');

app.get('/', (req, res) => {
    res.render('home')
})
app.listen(3000, () => {
    console.log("LISTENING ON PORT 3000")
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Seems like a CORS error, which happens when your request is blocked by your browsers' same-origin policy. Try adding 'Access-Control-Allow-Origin: "*"' to your request header to bypass it:

app.use(function(req, res, next) {
     res.header("Access-Control-Allow-Origin", "*");
     res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
     next();
 });

You can read more here.

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!