Skip to content

Instantly share code, notes, and snippets.

@zacharygolba
Created March 15, 2016 19:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zacharygolba/4b97ff8ee87213dd9d55 to your computer and use it in GitHub Desktop.
Save zacharygolba/4b97ff8ee87213dd9d55 to your computer and use it in GitHub Desktop.
Lux Controller - Example 2
import { Controller, action } from 'lux-framework';
class UsersController extends Controller {
params = [
'name',
'email',
'password'
];
@action
async login(req, res) {
const User = this.store.modelFor('user');
const user = await User.authenticate(req.params);
if (user) {
req.session.set('currentUserId', user.id);
}
return user;
}
}
export default UsersController;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment