When i developing react and vue frontends when testing with express backend i experienced that there are errors occurring. That error is easily fixed by using a library named cors. This is my study about cors

Cors meaning is cross origin resource sharing. It permits loading resources from other resources. It is the http header mechanism. That resource may be another domain,port,schema also.

When I wanted to make a request from www.domain1.com to www.domain2.com then I wanted cors.

Enable cors in node js server

Install cors package using following command

npm install cors
or
yarn add cors

Write code like this.

const express = require(“express”)
const app = express();
const cors = require(“cors”)
app.use(cors())

Cors technology has both client side and server side components.

--

--

Express

this is best for create backend for java script. this works fine in node js engine and can manage using npm

React Js

This is good for make single page web application. this library use to develop frontend. this library works with firebase,express,laravel and apache also.

Vue Js

this also frontend designing framework. this also work with laravel express and apache servers also.

React Native

this library is used to make android and ios applications. this concept is learn once and code anywhere. so this is very strong for production.

Electron

this is desctop application framework. this works with chromium.

Firebase

this is cloud server api for your apps. this is free too much functions like authentication,realtime database, firestore and storage also. this also works better with react angular vue also.

--

--