Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
La solicitud no pudo mostrar los datos del usuario de Express js

Estoy tratando de obtener datos de mi API backend (express.js) para mi cliente Vue, pero cada vez que obtengo "estado fallido o cancelado", no tengo ningún error en mi consola, excepto este:

imagen aquí

Que mi código backend route.js :

 const express = require('express') const router = express.Router() const { ensureAuth, ensureGuest } = require('../middleware/auth') const bodyParser = require("body-parser"); const User = require('../models/User') const cors = require("cors"); const app = express(); app.use(bodyParser.urlencoded({ extended: true })) // use cors options app.use(cors(corsOptions)) app.use(express.json()) router.get('/', ensureGuest, (req, res) => { res.render('visual') }) router.get('/userInfo', ensureAuth, async (req, res) => res.json({displayName : 'John Doe'}))

Mi Vue script dashboard.vue :

 <template> <img src="@/assets/images/avatars/0.jpg" alt="User Avatar"> <span>{{info.displayName}}</span> </template> <script> import axios from 'axios'; export default { data() { return { info: null, }; }, created() { axios.get('http://localhost:3000/userInfo') .then(res => { this.info = res.data; }) }, }; </script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!