0.0.8 • Published 6 years ago
@allegiant/sessions v0.0.8
sessions
Simple sessions module for the allegiant app framework.
There be 🐲 here! The API and functionality are being cemented, anything before a 1.0.0 release is subject to change.
Installation
npm install @allegiant/sessions --save
Usage
const App = require('@allegiant/core');
let server = App.create("https://localhost:7000", {
'@allegiant/sessions': {
enabled: true,
path: path.resolve(path.join(process.cwd(), 'sessions')),
autogen: true
}
});
server.get('/', function() {
if (!this.session.data.firstTimeServed) {
this.session.data.firstTimeServed = new Date()
}
this.content = `<h1>It just works! You first looked at this content on ${this.session.data.firstTimeServed}</h1>`;
return 200;
})
.start();
Copyright & License
Copyright © 2017 Allegiant. Distributed under the terms of the MIT License, see LICENSE