Join the Stack Overflow Community
Stack Overflow is a community of 6.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have the following things I want to accomplish. In the end I feel it is just a simple thing but I can't get my mind wrapped around it architecture-wise.

I have a simple NodeJS Express server that serves an AngularJS frontend via

 this.app.use(
        express.static(__dirname + '/' + settings.env)
    );

Now I have some API Endpoints that are supposed to be at least of RESTful path-naming. I have AJAX Calls to them on some button clicks on the Front-End. Let's say one Button is to load and view a list of "Loans"(Whatever this might be): GET /loans.

The Angular frontend reacts on and writes links like this: /#/loans

That was Question Part 1: Why is this? And more importantly: Is it common practice to keep it like that?

Now I am also sending out e-mails that have Buttons in them that the receiver can click. Right now I cannot remind anymore why I wanted this, but it made sense when I decided to.

I want to be able to request GET /loans as path on that button click in the e-mail and have the Express routing decide whether to run logic and return a json or to "reroute" to angular to render the page.

That was Question Part 2: Is this something I should or should not want to accomplish? And if I still want to accomplish it what would be the best way?

I'll have another shot on the 2nd Part in Short: I want to decide depending on the Accept-Header whether to return a json or to "reroute" to static files.

share|improve this question
    
Search for 'url angular hash' and/or see this article: Pretty URLs in AngularJS: Removing the # – Matthew Bakaitis Dec 12 '14 at 11:12
    
@MatthewBakaitis Thanks for the comment. I fear I did not clear the point correctly. Why shouldn't this be an express or node question. For me Angular in this case is just my choice of frontend it could be anything actually. I actually want to be able to curl a path and have either an html or a json returned. – haynzz Dec 12 '14 at 23:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.