How to setup Ember (with or without cli) to use already existing express server

Hey guys like the title says I have an already existing express.js server and I was wondering how I might use it as a backend for a new ember.js project. I saw the http-mocks and I don’t quite understand what they are for but It seems as though when you create a new one they come with express so I’m guess ember works fine with an express.js backend. Please feel free to ask me for any information that might be needed to answer this.

Thanks in advance, Mooror

Ok I just read about mocks over at the ember cli website and if I have it right mocks setup a temporary express server for development and make it easier to transition over to a real server when the time comes to deploy the app. But what if I already have an express server setup (locally atm) with an api, ready to use with ember. Is there a way to get the http-mock to connect to that server instead?

Thanks, Mooror

p.s. The api is being served from the express server to http://localhost:3000/api/

you can start you ember development server with the “–proxy” command.

From the docs:
“ember server - Starts the server. The default port is 4200. Use the --proxy flag to proxy all ajax requests to the given address. For example, ember server --proxy http://127.0.0.1:8080 will proxy all ajax requests to the server running at http://127.0.0.1:8080.”

Hey there maxn, thanks for your reply. I looked into the proxy command a bit but I was wondering. Am I correct in assuming that this command will still make ember server serve the app but request information from the proxy? I cant see how it would be able to serve the app from the proxy server as well. Ideally I would like my express server to serve the app and supply the data through the api.

Thanks in advance, Mooror P.s. Sorry I should have been more specific

In this case couldn’t you symblink / change the output path of ember-cli (–output-path flag) to your express apps public/view folder and create a express route that serves just static files? You don’t even have to deal with CORS or the proxy then but maybe there’s a problem im not seeing?

good luck