[Vuejs]-API 404 using VueJs, ExpressJs and Mongoose


Looks like axios is making the request on port 8080.

You can specify the correct port number in the .get method like so:

axios.get('/api/users', { port: 3000 }).then(...)


add in Server.js, you problem Cross-domain.
In place do not origin your url than accesses the vue.js

app.all('*', function (req, res, next) {
var origin = req.get('origin');
res.header('Access-Control-Allow-Origin', 'http://localhost:8080');
res.header('Access-Control-Allow-Credentials', true);
res.header('Access-Control-Allow-Headers', 'X-Requested-With');
res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-type, Accept, Authorization');

if (req.method === 'OPTIONS') {
    return res.status(200).end();



Finally worked it out. I needed to add the below code to the webpack.config file:

devServer: {
    proxy: {
        '/api/*' : {
            target: 'http://localhost:3000'

Leave a comment