Error deploying backend project

Porject id: c6e87e4d-11c8-412e-a080-be040b3c77f8 Hello everyone, I have this error when I click on the link to consult the enpoints, I don't know how to solve it. I inspected through the console and I got that error, how can I solve it. Thank you very much to all. this is the link. https://appmoviesbackend-production.up.railway.app/
No description
12 Replies
Percy
Percy11mo ago
Project ID: N/A
Brody
Brody11mo ago
you need to set the applicable CSP headers, give this mdn article a read https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
Devops Omar
Devops Omar11mo ago
I already did it, in the node.js app file and it doesn't work. const express = require("express"); const helmet = require("helmet"); const cors = require("cors"); require("dotenv").config(); const router = require("./routes"); const errorHandler = require("./utils/errorHandler"); // Esta es nuestra aplicación const app = express(); // // Middlewares app.use(express.json()); app.use(helmet({ contentSecurityPolicy: { defaultSrc: "*", }, })); // app.use(helmet()); app.use(cors()); // app.use("/api/v1", router); app.use(errorHandler); module.exports = app;
Brody
Brody11mo ago
please enclose code in triple backticks
Devops Omar
Devops Omar11mo ago
here app.use(express.json()); app.use(helmet({ contentSecurityPolicy: { defaultSrc: "*", },
Brody
Brody11mo ago
when sending code on discord enclose it in triple backticks
Devops Omar
Devops Omar11mo ago
const express = require("express");
const helmet = require("helmet");
const cors = require("cors");
require("dotenv").config();
const router = require("./routes");
const errorHandler = require("./utils/errorHandler");

// Esta es nuestra aplicación
const app = express();
//


// Middlewares
app.use(express.json());
app.use(helmet({
contentSecurityPolicy: {
defaultSrc: "*",
},
}));
// app.use(helmet());

app.use(cors());
//
app.use("/api/v1", router);

app.use(errorHandler);

module.exports = app;
const express = require("express");
const helmet = require("helmet");
const cors = require("cors");
require("dotenv").config();
const router = require("./routes");
const errorHandler = require("./utils/errorHandler");

// Esta es nuestra aplicación
const app = express();
//


// Middlewares
app.use(express.json());
app.use(helmet({
contentSecurityPolicy: {
defaultSrc: "*",
},
}));
// app.use(helmet());

app.use(cors());
//
app.use("/api/v1", router);

app.use(errorHandler);

module.exports = app;
Devops Omar
Devops Omar11mo ago
I'll check the link and comment tomorrow. I'm tired
Brody
Brody11mo ago
thats fair
Devops Omar
Devops Omar11mo ago
thank you so much
Brody
Brody11mo ago
haha I'm just sending you stuff to read
Want results from more Discord servers?
Add your server