DEV Community

Sean Brunnock
Sean Brunnock

Posted on • Updated on

Baby steps

So, in my quest to switch from LAMP to PERN, I'm going to update my old MySQL DB manager and turn it into a modern Postgres DB manager. This time, I'm going to use modern authentication techniques rather than my old basic HTTP authentication.

So, how do we do this? The Passport library seems to be the most popular. Great, let's use that. Passport uses sessions. Which library should I use? The Express team maintains express-session and cookie-session. Cookie-session looks simpler. Let's use that. Nope. It's not compatible with Passport currently.

Fine, we'll use express-session. express-session creates a session id and stores it in a cookie. How do I manipulate cookies in JS? I have to use something called encodeURIComponent. I've never used it. How does it differ from encodeURI? Time to do some research.

OK. I've updated my encodeURI demo so it now includes examples of encodeURIComponent and decodeURIComponent. That'll do for today.

Baby steps.

Discussion (0)