How to enable cors nodejs with express?

前端 未结 6 1097
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 07:04

In summary I am using a viewer like api of dicom files called cornerstone, for this I connect to the WADO service of dc4chee to get the dicom, dcm4chee runs port 8080, and m

6条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 07:26

    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');
    let app = express();
    app.use(cors());
    app.options('*', cors());
    

提交回复
热议问题