title: Can I change my .ejs file to .html to make it work with Node.js and Express?
body: <p>I have a index.html and wanted to link it to a twitter.ejs page. I was unsuccessful and now I am wondering if I can just change the extension from ejs to html. I tried to do it, but it does not work. Does only Node.js/Express work with a .ejs file?</p>
  
  <p>My code trying to redirect from index.html to twitter.ejs: <a href="http://jsfiddle.net/1moj4v07/4/" rel="nofollow noreferrer">http://jsfiddle.net/1moj4v07/4/</a></p>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;li&gt;&lt;a href="/twitter"&gt;Tweet!&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p><strong>script.js</strong></p>
  
  <pre><code>const express = require('express');
  const bodyParser= require('body-parser')
  const app = express();
  const MongoClient = require('mongodb').MongoClient
  var router = express.Router();
  
  var db
  
  MongoClient.connect('mongodb://name:password@cluster0-shard-00-00-fquoc.mongodb.net:27017,cluster0-shard-00-01-fquoc.mongodb.net:27017,cluster0-shard-00-02-fquoc.mongodb.net:27017/twitter?ssl=true&amp;replicaSet=Cluster0-shard-0&amp;authSource=admin', (err, database) =&gt; {
    if (err) return console.log(err)
    db = database
    app.listen(3000, () =&gt; {
      console.log('listening on 3000')
    })
  })
  
  app.use(bodyParser.urlencoded({extended: true}))
  
  var path = require('path')
  
  
  app.set('view engine', 'ejs')
  
  app.set('views', path.join(__dirname, 'views'));
  
  app.use(express.static(path.join(__dirname, '/public')));
  
  app.get('/', (req, res) =&gt; {
    db.collection('tweets').find().toArray((err, result) =&gt; {
      if (err) return console.log(err)
      res.render('twitter.ejs', {tweets: result})
    })
  })
  
  app.get('views/', (req, res) =&gt;{
    res.render(views,local)
  })
  
  app.get('/twitter',function(req,res){
      res.render('twitter', {});
  });
  
  app.post('/tweets', (req, res) =&gt; {
    db.collection('tweets').save(req.body, (err, result) =&gt; {
      if (err) return console.log(err)
      console.log('saved to database')
      res.redirect('/')
    })
  })
  </code></pre>
  
  <p>Folder structure</p>
  
  <pre><code> twitter
      ├── views
      |   └── twitter.ejs
      |   
      ├── public
      |   └── styles.css
      |
      ├── index.html  
  </code></pre>