DEV Community

Pere Sola
Pere Sola

Posted on

Solve CORS error in express server

  • Install cors library: npm i cors
  • Add the following code:
const express = require("express")
var cors = require("cors")

const app = express()

app.use(cors())
Enter fullscreen mode Exit fullscreen mode

Top comments (0)