The application consists of a few components. There is the main app.js file which controls much of the application. And I used express for Node.js with handlebars to add users, create details and search through the users.
In this adduser.handlebars file I create the "POST" method with an action that will send the information below in a post to /user/add which will create the new user in Redis.
Next in the details.handlebars file below I set everything up to handle the display of the records that are retrieved from Redis.
Then I have a searchusers.handlebars file which handles the search functionality.
The main.handlebars file handles the HTML output and is quite similar to any other HTML page with the interesting differentiation of how the body content is handled. The triple curly brackets tell handlebars to display the information from Redis within this container.
And now that I've gone over the files that connect with the main app.js file perhaps it will help clear everything up a bit to focus on how the directives are being initiated. Below I am showing the different constructor variables I setup. This is a Node.js app using express, express-handlebars and I set up a few other parameters that are required.
With everything setup it's simple to create the Redis client from here.
Now I can search through the records and add users from this Redis/Node.js application that I can access from the internet.
No comments:
Post a Comment