Skip to content
Express middleware for Turbolinks 5 support
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib version 1.0.0 Mar 11, 2019
.gitignore version 1.0.0 Mar 11, 2019
LICENSE version 1.0.0 Mar 11, 2019 version 1.0.0 Mar 11, 2019
package-lock.json version 1.0.0 Mar 11, 2019
package.json link to github repo in package.json Mar 11, 2019


Express middleware for Turbolinks 5 support. Aims to provide similar functionality as the turbolinks-rails gem, but for Express.

Getting Started

  1. yarn add turbolinks-express

  2. Use the middlewares after your session middleware. For example:

    // app.js
    var express = require('express');
    var session = require('express-session');
    var turbolinks = require('turbolinks-express');
    var app = express();
    app.set('port', (process.env.PORT || 5000));
      secret: 'secret_key_base',
      resave: false,
      saveUninitialized: true
    // turbolinks
    app.listen(app.get('port'), function() {
      console.log('Node app is running on port', app.get('port'));
      console.log('Running in '+ app.settings.env)


I won't rehash what Turbolinks is, but when using it you have to make two server side changes:

  1. You have to tell Turbolinks how to update the address bar after chained redirects. The XHR requests will silently follow the redirects, but then your address bar will be out of date. Official docs

  2. After remote form submissions that would normally redirect, we return JavaScript that performs a Turbolinks.visit. Official docs

Adding these middleares allows you to use Express's res.redirect("/users") as you always have while performing those optimizations for you ☝️



You can’t perform that action at this time.