Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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