do
npm install cors --save
and just add these lines in your main file where your request is going.
const cors = require('cors');
const express = require('express');
const app = express();
app.use(cors());
More Related Contents:
- Writing to files in Node.js
- 5xx or 4xx error with “No ‘Access-Control-Allow-Origin’ header is present”
- How to access the request body when POSTing using Node.js and Express?
- Render basic HTML view?
- Using socket.io in Express 4 and express-generator’s /bin/www
- Function to convert timestamp to human date in javascript [duplicate]
- How do I remove documents using Node.js Mongoose?
- Rest with Express.js nested router
- What is NODE_ENV and how to use it in Express?
- TypeError: Router.use() requires middleware function but got a Object
- How to convert CSV to JSON in Node.js
- UnhandledPromiseRejectionWarning: MongooseServerSelectionError
- Express js form data
- How to send flash messages in Express 4.0?
- Node + Express with static HTML. How to route all requests to index.html?
- Accessing EJS variable in Javascript logic
- res.sendfile in Node Express with passing data along
- Getting Spotify API access token from frontend JavaScript code
- Accessing Express.js local variables in client side JavaScript
- Node.js request CERT_HAS_EXPIRED
- Node.js / Express.js – How to override/intercept res.render function?
- configure node express to serve static bower_components?
- require(‘babel/register’) doesn’t work
- Express: Setting content-type based on path/file?
- What do “module.exports” and “exports.methods” mean in NodeJS / Express?
- In Node.js/Express, how do I automatically add this header to every “render” response?
- express.js – how to intercept response.send() / response.json()
- Access from origin ‘https://example.com’ has been blocked even though I’ve allowed https://example.com/
- Difference between res.send and res.json in Express.js
- Can’t get rid of header X-Powered-By:Express