Вот мой серверный код:
import express from 'express';
import cors from 'cors';
import cookieParser from 'cookie-parser';
import bodyParser from 'body-parser';
const app = express();
// app.use(cors()); // Also tried this
app.use(cors({ credentials: true, origin: true }));
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.get('/', (req, res) => res.json({ message: 'OK' }));
app.listen(3000);
Вот код моего веб-сайта (обслуживается с localhost:5000):
const response = await superagent.get('localhost:3000/')
.withCredentials()
.send();
Но это заблокировано CORS:
Error: Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.
Почему?
Я использую Firefox 58 и Node.js 6.10.





Забыл приставку http://:
const response = await superagent.get('http://localhost:3000/')
.send();
Что за день...