Network request failed at XMLHttpRequest.xhr.onerror

Viewed 382

I having a problem with connecting backed with front. So I found a tutorial how to create JWT auth with front end on the youtube, so in the devtools of front-end I am having this error TypeError: Network request failed at XMLHttpRequest.xhr.onerror (browser-ponyfill.js:480) when I run this code in the backend with npm start this shows in the terminal INFO: 🚀 Access your server on http://localhost:undefined INFO: 📉 Access your graphql playground on http://localhost:undefined/graphql. I know it not the best explination. I think the problem is in the backend.

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)
0 Answers
Related