You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, what is the most common reason that sending a request to the specified POST path does not reach the server when the get request is served first and then the one that does not reach the server, i.e. post?
The browser does not block CORS requests because I have added the "cors" dependency: "^2.8.5" in the environment.
I don't have any errors in the console or in the server logs.
`let express = require("express"),
app = express(),
portApp = (process.env.PORT || 3000),
fetch = require("node-fetch"),
path = require("path"),
cors = require("cors"),
webSocket = require("socket.io");
app.listen(portApp, function () {
console.log("Web starting...");
});
app.use(cors());
app.use(express.static("node-rest", {
setHeaders: function (response, path, stat) {
if (path.endsWith(".js")) {
response.set("Content-Type", "application/javascript");
}
}
}));
app.post("/test", function (request, response) {
response.end();
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, what is the most common reason that sending a request to the specified POST path does not reach the server when the get request is served first and then the one that does not reach the server, i.e. post?
The browser does not block CORS requests because I have added the "cors" dependency: "^2.8.5" in the environment.
I don't have any errors in the console or in the server logs.
`let express = require("express"),
app = express(),
portApp = (process.env.PORT || 3000),
fetch = require("node-fetch"),
path = require("path"),
cors = require("cors"),
webSocket = require("socket.io");
app.listen(portApp, function () {
console.log("Web starting...");
});
app.use(cors());
app.use(express.static("node-rest", {
setHeaders: function (response, path, stat) {
if (path.endsWith(".js")) {
response.set("Content-Type", "application/javascript");
}
}
}));
app.post("/test", function (request, response) {
response.end();
});
Beta Was this translation helpful? Give feedback.
All reactions