Best way to use express with ember-cli and grunt


#1

Is any suggestions for using express, ember-cli, grunt for the project?


#2

I suggest ember-cli.

Edit: Take a look at my ember-cli example: https://github.com/broerse/ember-cli-blog


#3

@broerse, thanks for your reply. This is not what i am looking for. It does not have an express server file.


#4

ember-cli uses Express 4.12.3 when you run ember s

I don’t seem to understand the question then. Do you want to serve json on the backend with Express to your ember-cli app?


#5

It does use express, and it’s extensible. Here is an example of something I threw together on how you can extend the ember-cli express instance… to add middleware/routes/whatever. Disregard the example code, it’s shit I threw together for an unrelated demo.

https://github.com/jasonmit/locale-root-url/blob/master/server/index.js

This server/index.js module will be invoked as expected, and passed in the instance (line 40).


#6

@broerse, yes i want to serve json on the backend with express.


#7

@jasonmit, thanks for your reply. I want to serve json response with express for my ember app. This are all the question which is popping me

How ember-cli serving static files and can we use same port number for my express backend which serve json response?

AFAIK when we use broccoli there is no need to use grunt:watch task for frontend assets but for backend we have to use grunt:watch to look for changes in the express code (to restart the node server). When we restart the node server (using nodemon), is there any conflict occurs between ember-cli running node server and grunt running node server?


#8

Can’t help with that but I used https://github.com/fortunejs/fortune in the past for this with success. Perhaps try it.


#9

What I posted is a simple example of me adding middleware to the ember-cli express instance. You can add take that example and add routes which respond with json like you normally would with any express app.