Hopefully you were able to learn from this lesson some useful things:
-
how to create registration and login endpoints to authenticate users with a username and password,
-
how and why to salt and hash passwords,
-
how to use cookies to maintain a login over a period of time,
-
how to restrict API endpoints to logged in users or to administrative users,
-
how to write a script to create an administrative user,
-
how to factor your Node.js code into modules to make it easier to maintain,
-
how to store data that is linked to a user in Mongo using Mongoose, and
-
how to set up different views for when a user is logged in or when a user is an administrative user.
I hope you also see that there is much more we could add to this application. This might include:
-
allowing an administrator to create other admins,
-
providing for the ability to assign tickets to support staff to handle them,
-
providing for more roles, such as support staff who can handle tickets but not assign them,
-
creating a chain of replies for tickets, so users and staff can have a dialogue about an issue,
-
providing other types of status for a ticket, such as assigned or in progress,
-
allowing staff to directly change the status of a ticket,
-
including email functionality on the back end to let admins know when new tickets are created, or
-
providing paid accounts that get priority access to added features.
There is so much more you can do to create a more full-featured web application.
Thank you for following along with this tutorial!