var basicAuth = require('basic-auth-connect');
app.use(basicAuth('username', 'password'));
Follow the same rule, just install the necessary modules then we can use the old 3.0 codes! But the names of the new modules are different from original ones. The complete mapping table is as below (thanks to Chris Sevilleja):
Express 3.0 Name | Express 4.0 Name |
bodyParser | body-parser |
compress | compression |
cookieSession | cookie-session |
logger | morgan |
cookieParser | cookie-parser |
session | express-session |
favicon | static-favicon |
response-time | response-time |
error-handler | errorhandler |
method-override | method-override |
timeout | connect-timeout |
vhost | vhost |
csrf | csurf |
沒有留言:
張貼留言