I use nodeJs to render html, but html is wrapped in pre tags.

I use nodeJs to render html, but html is wrapped in pre tags

the figure is as follows:

The code of the

section:

var express = require("express");
var router = express.Router();
var path = require("path");
var bodyParser = require("body-parser")

var app = express();

// view engine setup
app.set("views", path.join(__dirname, "public"));
app.set("view engine", "html");

//post
app.use(express.static(path.join(__dirname, "public")));

router.get("/", function(req, res, next) {
  res.render("index");
})


Aug.02,2021

found the problem. I wrote res.header ("Content-Type", "application/json;charset=utf-8") in a cross-domain code;

Menu