Registering a new user
To handle the registration of users, we need to update both our frontend and backend code. The client-side part of the application will collect the data and the backend will store it in the database.
Updating the frontend
We updated the navigation and now, if users click on the Register link, the app will forward them to a /register
route. We have to tweak our router and register a handler in the following way:
var Register = require('./controllers/Register'); Router .add('register', function() { var p = new Register(); showPage(p); })
As with the home page, we will create a new controller located in frontend/js/controllers/Register.js
, as follows:
module.exports = Ractive.extend({ template: require('../../tpl/register'), components: ...
Get Node.js By Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.