title: MVC with angular Node.js and mongodb
body: <p>I am building a e-commerce application using MVC with angular and Node.js</p>
  
  <p>The architecture diagram is as below</p>
  
  <p><a href="https://i.stack.imgur.com/AwPMi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AwPMi.png" alt="enter image description here"></a></p>
  
  <p>In MVC, I am using partial views which will contain sections like "<strong>Featured products</strong>", "<strong>Favourite products</strong>" etc. These will be used in pages where ever required by using <code>@Html.partial("layoutname")</code>. Also header/footer etc are in the shared folder as layouts</p>
  
  <p>The authentication is handled using  <code>oAuth</code>, which will provide the token to the user. Request for data are sent to Node.js and it will validate the token again <code>for requests which requires user details</code> like fetching favourites etc</p>
  
  <p>I am doing this by configuring the app.js in node.js</p>
  
  <pre><code>if (req.method == "POST") {
          try {
              AuthenticationFunction();
             //this will authenticate the token and call next() if success
          }
          catch (ex) {
              res.send("Some message");
          }
      } 
  </code></pre>
  
  <p>For data binding I use Angular</p>
  
  <p>Are there any better alternates that should be used in this architecture?</p>
  
  <ul>
  <li><p>I use MVC for its ability to route requests, will normal iframe and 
     plain html be faster than cshtml pages?     (I tried angular routing but was <a href="https://stackoverflow.com/questions/31981730/navigating-to-url-directly-after-removing-hashbangs-not-working">not able to remove the # from url and get it working</a>)</p></li>
  <li><p>In node.js should I use passport.js? will it be faster/better than
     my current approach?</p></li>
  <li>Is this model secure? I send the token and userid with request and validate them in node.js for requests requiring this authentication</li>
  </ul>