mis archivos estáticos no se cargan para ejs. Recibo el siguiente error. He intentado de varias maneras cargar las estáticas, pero aún recibo los siguientes errores.
Refused to apply style from 'http://localhost:8080/css/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. info-order:63 GET http://localhost:8080/js/order.js net::ERR_ABORTED 404 (Not Found) info-order:1 Refused to apply style from 'http://localhost:8080/css/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.mi archivo de configuración tiene el siguiente código ...
const express = require("express"); const path = require("path"); /*config view engine*/ let configViewEngine = (app) => { app.use(express.static(path.join(__dirname + "./src/public"))); app.set("viewEngine", "ejs"); app.set("views", "./src/views"); }; module.exports = configViewEngine;Y he vinculado la hoja de estilo de la siguiente manera.
<link rel="stylesheet" href="/css/style.css" />mi etiqueta de secuencia de comandos en ejs como folow ..
<script src="/js/order.js"></script>Prueba esto:
app.use(express.static(path.join(__dirname, 'src/public')));