This is actually an express question rather than an angular one - express
serves up your index route and the rest of the routing is handled in
angular.

I just do the usual thing in express - app.get('/', function(req, res,
next) {res.send('200', 'hello world!')}).

But actually with angular, you can have express use a static middleware IMO
- you're just really serving up index.html, unless you're doing something
with jade or haml on index.

In my dev server, I use the express static middleware to serve my /web
directory which includes index.html, main.css and templates, and using
express mainly for serving up json resources needed by the page. I also use
a task runner to keep my coffee/sass files compiled and run a livereload
server (I use broccoli, but ymmv).

In production, it's similar, but I use nginx to serve the frontend statics
in a compiled / minified state. Broccoli build frontend and done.

Eric


On Sun, Jul 27, 2014 at 1:04 PM, Nathan Weinrich <[email protected]>
wrote:

> I'm am starting a new MEAN project, and wanted to use the latest Express
> 4.x to take advantage of some new features, in particular the new router.
>  I have installed nodeclipse and created a new Node/Express project and
> then looked to
> http://scotch.io/bar-talk/setting-up-a-mean-stack-single-page-application
> for a template to working in the rest of the MEAN components.  The problem
> I have is i do not know how to convert something like this: app.get('/',
> routes.index); to use the new router.   I tried: app.get('/',
> routes.index); but it says a callback function is requred.  I don't what to
> put in the callback function, as ever example i've found is either just
> returning a string: res.send('im the home page!'); or just a
> file res.sendfile('./public/index.html');  I need to return the reference
> to the routs.index.  Any suggestions? thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to