Axios + Express

Viewed 43

Hellow, i need help, i make web apps with axios, express, vue 3.0, I write easy server on express, and try to received info from server, but see error on console Server on port: 3000 Website on port: 8080

Vue file

async created() {
axios.get('http://localhost:3000/getall').then((res)=>{
  console.log(res.data);
},(err)=>{
  console.log(err);
})

}

Express file


const userApi = require('./api/userApi');
const bodyParser = require('body-parser');
const express = require('express');
const app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));


app.use('/api/user', userApi);

app.get('/getall',(res)=> {
    res.send('Hello world');
});

app.listen(3000);
console.log('success listen at port:3000..');


  error
GET http://localhost:8080/getall 404 (Not Found)
0 Answers
Related