Wednesday, 15 March 2017

Forbit CORS request in node.js

I have a nodejs Express app which serves a static front-end app. I have an endpoint that I'd like to prevent the access from all the others domains.

One solution could be using CRSF but I'd prefer avoiding this. Is there a simple way?

My app is very simple:

app.use(express.static(path.join(__dirname, '/dist')));
app.use(bodyParser.json());

app.post('/endpoint', (req, res) => {
    res.send();
});
app.listen(process.env.PORT || 8080);



via rocketer

No comments:

Post a Comment