javascript - Where does user registration data get stored with node.js -
i have started explore node.js , wondering user data stored if wanted create registration form/login , logout functionality website.
i know php form data written , stored sql database on server.
what happens when start use node.js authentification packages. still need set sql database on server? or work in different way? usernames, passwords , reg e-mails stored?
rather confused eager learn node.js , make simple working registration form.
thanks guys!
form data isn't stored (not unless you've handled stored).
when submit form, you're creating http request, , http request, server can designed handle data send said http request...
so, lets made form this:
<form method="post" action="/register"> <input type="text" name="email"> <input type="submit"> </form>
through magic in browser, when click submit, creates http request where-ever action
parameter pointing to.
so, can handle data server-side in our nodejs:
(lets we've made method serve form @ // ...
):
http.createserver(function(req, res){ // ... if (req.method === "post") { // it's post request, lets gather data var chunks = [], data = ""; req.on("data", function(chunk){ chunks.push(chunk.tostring()); }); req.on("end", function(){ data = chunks.join(); // handle data here... save it, whatever need. }); } });
Comments
Post a Comment