UNPKG

meme-magic

Version:

An A-Frame, React, Redux front-end with Sessions, Websockets, SQL, and Authentication built into the backend.

20 lines (14 loc) 420 B
'use strict'; import parseurl from 'parseurl'; /* Very basic use of session configuration that simply monitors your views to any URL. */ export default (app) => { app.use((req, res, next) => { let views = req.session.views; if (!views) views = req.session.views = {}; const pathname = parseurl(req).pathname; views[pathname] = (views[pathname] || 0) + 1; next(); }); };