Hi Everyone,

I am working on a project learning Node.js.  Does anyone know if there is a command similar to how Apache uses .htaccess to rewrite file URLs?

For example, to remove the .html after a file name in a URL we use:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^\.]+)$ $1.html [NC,L]

If this equiviliant does exist for Node.js, where does it go?
Below is the content of my server.js file.

var express = require('express');
var app = express();

// set the port of our application
// process.env.PORT lets the port be set by Heroku
var port = process.env.PORT || 8080;

// set the view engine to ejs
app.set('view engine', 'ejs');

// make express look in the public directory for assets (css/js/img)
app.use(express.static(__dirname + '/app'));

// set the home page route
app.get('/', function(req, res) {

    // ejs render automatically looks in the views folder
    res.render('index');
});

app.listen(port, function() {
    console.log('Our app is running on http://localhost:' + port);
});



Thanks for any help!