简体   繁体   中英

Ember-Cli-Mirage 404

Just followed the documentation but every time I navigate or call to the url, it returns 404 for me

// app/mirage/config.js
export default function() {

  this.get('/api/users', function() {
    return {
      users: [
        {id: 1, name: 'Zelda'},
        {id: 2, name: 'Link'},
        {id: 3, name: 'Epona'},
      ]
    }
  });

}

Uncaught UnrecognizedURLError: /api/users

Thanks for your help.

Navigating directly to that URL in your browser will not follow the mirage pipeline. Rather, when your ember application would have queried the end points you have configured, mirage will send mocked data instead. Therefore you need to implement something that will call your endpoint from within your Ember app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM