I\'m using Ember CLI 0.0.36. When I run ember server in my project folder, my understanding is that a server buried in some Brocoli process gets started. Howeve
This is actually pretty simple with Ember CLI 0.0.40:
Create folder structure
ember new my-app
Go into the newly created folder
cd my-app
Generate api-stub* (see update)
ember generate api-stub my-server
This latter command creates a server folder with an index.js file and a routes folder with a my-server.js file.
Open my-server.js file and you see:
module.exports = function(app) {
var express = require("express");
var myServerRouter = express.Router();
myServerRouter.get("/", function(req, res) {
res.send({my-server:"something"});
});
app.use("/api", myServerRouter);
};
All you need to do then is to change that file. If the Ember app makes calls to /api/hamsters and /api/project, edit as follows:
module.exports = function(app) {
var express = require("express");
var myServerRouter = express.Router();
myServerRouter.get("/hamsters", function(req, res) {
res.send({ ... });
});
myServerRouter.get("/project", function(req, res) {
res.send({ ... });
});
app.use("/api", myServerRouter);
};
To start the server (from project's root):
ember server
Make sure you have updated node.js to the latest version as well.
As of Ember CLI 0.0.41 (via this PR) api-stub has been renamed http-mock.