lundi 23 mars 2015

Configure Ember CLI to use http-mock

The setup:



ember new shop
cd shop
ember install:addon ember-cli-scaffold
ember generate scaffold product name:string available:boolean
ember generate adapter product


I'd like to use http-mock but http://ift.tt/1Osat0p tells me to do this:



ember g http-mock products


After that I use this code to generate two example products:


server/mocks/products.js



module.exports = function(app) {
var express = require('express');
var productsRouter = express.Router();

productsRouter.get('/', function(req, res) {
res.send({
'products': [
{
id: "1",
name: 'Orange',
available: true
}, {
id: "2",
name: 'Apple',
available: false
}
]
});
});

[...]


When I use the command ember server and browse to http://localhost:4200/products I see nothing.


What am I missing? What else do I have to start or to configure?





Aucun commentaire:

Enregistrer un commentaire