title: Build a simple SPA using Node.js + Express
body: <p>I develop a web application using <strong>Node.js</strong> for the Back End and HTML/CSS/JS as Front End. I am attempting to build a single page app using <strong>Express</strong> framework.</p>
  
  <p>I want to build a single page application using just Node.js or JavaScript, I know that for the response we could call something like <code>res.render('contact')</code>, but this is not working in my case because I wan't to change dynamically my page, I don't want any additional frameworks like React, Angular, ...</p>
  
  <p>On my <strong>index.html</strong> page, there is a menu that each of its elements contain a hyperLink. For example when clicking on contact hyperLink in <strong>index</strong> page, I want to display on the same page dynamically the content of contact page with forms...ect without loading the page :</p>
  
  <pre><code>    &lt;li&gt; &lt;a href="/contact"&gt;Contact&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>My <strong>server.js</strong> file that defines the routes, by default I am directed to index page :</p>
  
  <pre><code>//to define the routes
  var express = require('express'), app = express();
  //to call multiple template engines easly, like html page...ect
  var engines = require('consolidate');
  
  app.engine('html', engines.nunjucks);
  app.set('view engine', 'html');
  app.set('views', __dirname + '/public');
  app.use(express.static(__dirname + '/public'));
  
  
  app.get('/', function(req, res){
      res.render('index');
  });
  
  app.get('/contact', function(req, res){
      res.render('views/contact');
  });
  
  
  var server = app.listen(8080, function(){
      console.log('Listening on port ' + server.address().port);
  });
  </code></pre>
  
  <p>I know that SPA live on a single HTML document, but how I can do this with Express Framework without loading the pages? I am a bit lost.</p>