How do I setup the api-stub in an ember-cli app?

I’m setting up a basic app using ember-cli and am running into trouble with the api-stub with ember-data. I’ve referenced the api-stub README and have referenced the ember guides, but can’t figure out what I’m missing. I’m a bit of a noob, so forgive any obvious oversights on my part.

Here’s my setup…


server.get('/listings', function(req, res) {
  var listing = {
    "listing": [{
      "id": 1,
      "title": "Sunny 1-bedroom",
      "unit_type": "1br / 1ba",
      "description": "Roomy 1-bedroom apartment in pre-war walkup. Gets great morning light from the south."
      "id": 2,
      "title": "Large 2-bedroom",
      "unit_type": "2br / 1.5ba",
      "description": "Roomy 2-bedroom apartment in pre-war walkup. Gets great morning light from the south."


var ApplicationAdapter = DS.RESTAdapter.extend({
	namespace: 'api'
export default ApplicationAdapter;


this.resource('listings', function() {
	this.resource('listing', { path: '/:listing_id' });


var ListingsRoute = Ember.Route.extend({
	model: function() {
export default ListingsRoute;


var attr = DS.attr,
    hasMany = DS.hasMany,
    belongsTo = DS.belongsTo;
var Listing = DS.Model.extend({
  title: attr(),
  unit_type: attr(),
  description: attr()
export default Listing



In console it shows a 404 for …/api/listings and ember inspector in chrome is showing no records.

Any help much appreciated!

I’ve also put this up on Stackoverflow, and will make sure to cross post any answers.

hey, sorry for the confusion. The API Stub stuff in the cli doesn’t work yet. Hopefully it (or something similar) will work soon.

related issue:

Api-stub in Ember App Kit should be working just fine. You could start your app using app kit and then migrate to ember-cli when it becomes production ready.

1 Like

@hayvok thanks. I’ve started messing around with it and think it’s probably the best option to actually get some work done while Ember-CLI continues to get fleshed out.