First time posting here, so please let me know if this isn't the place to ask questions like this.I have a SPA (Vue) that talks with an API (express) and only need to authorize the user on POST requests (no need for a session).I was thinking of going with JWT but I heard a lot of people saying how storing in localStorage makes you susceptible to XSS and how you should store it in a httponly secure cookie, but then now you need to deal with CSRF, not to mention I have to handle all of the refresh token nonsense and it's just exploding in complexity!!So I thought 'maybe I'll go with good ol' cookie sessions instead', but I'm using an API, and literally everybody and their mother only uses csurf for rendering in a view and there's NO resource (I've wasted way too much time on this) about how to do csrf protection when you have a headless API...So now I'm stuck (and frustrated). What should I do for my use case?
Submitted December 02, 2018 at 12:01PM by thepotatochronicles
Sunday, 2 December 2018
not returning data to client-side
i'm putting the data (from the promise) into res. At best, I am getting nothing back but 5 headers. Tinkering the code in sending it back client-side resulted into 'can't set headers after they're sent' (using res.send(data)) or unexpected U JSON when I used JSON.parse. For the latter, it means my data is undefined meaning I'm likely not capturing the data from the promise. What am I missing here? getUsers(req, res) { var usersRef = db.collection('users'); usersRef.get() .then(snapshot => { snapshot.forEach(doc => { console.log(doc.id, '=>', doc.data().name); let data = {uid: doc.id, name: doc.data().name}; return data; }); }) .then( data => { res.json(data); }) .catch(err => { console.log('Error getting documents', err); process.exit(); });
Submitted December 02, 2018 at 09:11AM by kekcoke
Submitted December 02, 2018 at 09:11AM by kekcoke
Saturday, 1 December 2018
Creating separate "screen" for console UI
How programs like less, more, man, vim, emacs create a "screen" for the interactions with the user? It is not outputted to your terminal window, but rather they use some other output to manage it. I would like to create a console UI with similar "screen" and maybe you know some libraries or resources to help me implement it. Thanks
Submitted December 02, 2018 at 05:49AM by thatsmesasha
Submitted December 02, 2018 at 05:49AM by thatsmesasha
A VSCode extension I made for managing PM2 processes
https://ift.tt/2Ea1ioK
Submitted December 02, 2018 at 12:45AM by alsiola
Submitted December 02, 2018 at 12:45AM by alsiola
Question about turning node script into daemon that starts on launch
I want a user to be able to npm install [my-package] and then my node script automatically installs a daemon on any linux or macos system that will keep the daemon alive across system restarts.One option is forever.js, but that hasn't been updated in 2 years. Another option is PM2, but it looks like the user has to manually enter the startup command into the console.Any thoughts or input would be greatly appreciated.
Submitted December 01, 2018 at 08:37PM by LickingWoundSalt
Submitted December 01, 2018 at 08:37PM by LickingWoundSalt
Node learning resources
I've been working with Angular for like a month, now. I'd like to start making the jump to the back-end aswell. I think I'll be learning Node, Express and MySQL and/or MongoDB.I'm looking for some good guides/courses/resources to learn these. Which ones would you guys suggest? Preferably free :P
Submitted December 01, 2018 at 07:07PM by enethor
Submitted December 01, 2018 at 07:07PM by enethor
Authentication/Authorisation without Express.js?
Hey, y'all!I've been learning Node.JS (without Express.js) for a while, and I decided to learn by making a server and whatnot. I went for the obvious IM-type thing, but I ran into "password problems", so I changed it and made a sorta kanban-ish thing.But now I'm stuck because I really need Auth in my app. I've been strongly cautioned never to rig up auth on my own, so I turned to Passport.js — only to find that I had to use Express.js to use Passport.I'm not against Express or anything — in fact, it's next on my list — but I want to see how much I can do with Node.js alone, without letting something higher-level abstract everything away from me.So, in sum: Authentication & Authorisation without Express.js. (Also, a tutorial would be nice, I'm a beginner.)Thanks, folks!
Submitted December 01, 2018 at 09:56AM by turntopage294
Submitted December 01, 2018 at 09:56AM by turntopage294
Subscribe to:
Posts (Atom)