Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| var express = require('express'); | |
| var cookieParser = require('cookie-parser'); | |
| var session = require('express-session'); | |
| var flash = require('express-flash'); | |
| var handlebars = require('express-handlebars') | |
| var app = express(); | |
| var sessionStore = new session.MemoryStore; | |
| // View Engines |
| /* ******************************************************************************************* | |
| * THE UPDATED VERSION IS AVAILABLE AT | |
| * https://github.com/LeCoupa/awesome-cheatsheets | |
| * ******************************************************************************************* */ | |
| // 0. Synopsis. | |
| // http://nodejs.org/api/synopsis.html | |
| var express = require('express'); | |
| var session = require('express-session'); | |
| var cookieParser = require('cookie-parser'); | |
| var flash = require('connect-flash'); | |
| var app = express(); | |
| app.use(cookieParser('secret')); | |
| app.use(session({cookie: { maxAge: 60000 }})); | |
| app.use(flash()); |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| # control color output via ASCII codes for better visual aspsect in terminal | |
| git config --global color.ui auto | |
| # update line-ending support for win/unix cross-platform (cr/cflf) | |
| # force to be LF in the repo (regardless of OS) | |
| git config --global core.autocrlf input | |
| # force windows t oconvert to platform on checkout and back on commit | |
| git config --global core.autocflf true | |
| # individually control portions of a file (patch mode) |
| // articles per page | |
| var limit = 10; | |
| // pagination middleware function sets some | |
| // local view variables that any view can use | |
| function pagination(req, res, next) { | |
| var page = parseInt(req.params.page) || 1, | |
| num = page * limit; | |
| db.articles.count(function(err, total) { | |
| res.local("total", total); |