Status
This week I have spent on connecting things to have properly working website at the end of the month as that’s the moment when ‘Daj się poznać’ is going to end.
First, I have linked the models and the forms to have videos properly saved in my database. Then I have added some simple display for YouTube videos and some stubs for next videos streaming portals (Vimeo comes next). I have added some tests and started to work on authentication, this part is in progress so I will have some more concrete stuff later but I will already write a bit about my plans.
PassportJS
Passport is authentication middleware for Node.js. Extremely flexible and modular…
Sounds good. So it’s a JavaScript library that has taken a modular approach and each type of authentication is realized in different module, which passportjs is calling strategies. I will let you read the strategies list on their website, but just to mention a few out of over 300 hundreds strategies: facebook, google, twitter, LinkedIn and actually whatever you could think of.
What I would need for my website is user/password authentication with some passwords hashing etc.
The strategy I need to use is called local strategy. I already started to create the necessary components and adapt my menu to allow sign-in/up as that’s what needs to happen first before I actually use passport.
Facebook, twitter and google also sound good, so I might be interested in doing this later as well, of course depending on how hard will it be. Believing passportjs website it’s a piece of cake… we’ll see 🙂
Express routes in typescript
I have quietly skipped this fact before, but I still have pending work on the express routes level, which are still in pure JavaScript, not in typescript. I have already started to modify it, as I would like to use some typescript stuff to work with User entities which will be needed during authentication phase. This also means I will need to learn about using PassportJS with typescript. I think that’s likely to be a topic of one of my next posts.
Problems, problems…
Few days ago, after updating some dependencies and typings, I have noticed I get a lot of warning messages about duplicated classes in the typings definition for many libraries I am using. After checking the content of those typings definition, it seems the content is correct – the classes are repeated – but they are defined in separate modules, so that shouldn’t bring any error. I might need to do some cleanup to resolve it, but since that doesn’t block me at work, I will try to do this as late as possible.
Updating npm packages is still very painful process for me. There’s always something that goes wrong and that generates a huge time waste, so I will spare myself such surprises before the end of the contest and try to focus on finalizing things. Stay tuned.