node.js - 网络请求在 XMLHttpRequest.xhr.onerror 处失败
问题描述
我在连接正面与背面时遇到问题。因此,我在 youtube 上找到了如何使用前端创建 JWT 身份验证的教程,因此在前端的 devtools 中,TypeError: Network request failed at XMLHttpRequest.xhr.onerror (browser-ponyfill.js:480)
当我使用 npm start 在后端运行此代码时出现此错误,这在终端中显示INFO: ≡ƒÜÇ Access your server on http://localhost:undefined INFO: ≡ƒôë Access your graphql playground on http://localhost:undefined/graphql
。我知道这不是最好的解释。我认为问题出在后端。
const { auth } = require('@tensei/auth')
const { tensei } = require('@tensei/core')
const { graphql } = require('@tensei/graphql')
tensei()
.plugins([
auth()
.user('Customer')
.plugin(),
graphql()
.middlewareOptions({
cors: {
credentials: true,
origin: ['http://localhost:3000']
}
})
.plugin()
])
.databaseConfig({
type: 'sqlite',
dbName: 'tensei.sqlite',
})
.start()
.catch(console.log)