ganeshmani / cloudnweb-comments

This Repo is a comment section for my blog cloudnweb.dev
0 stars 0 forks source link

Implementing Basic Authentication using Express and Typescript #13

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Implementing Basic Authentication using Express and Typescript

Do you use express for your backend and curious about building a basic auth using express and Typescript. let's implement express typescript basic auth with different patterns.

https://cloudnweb.dev/2021/05/express-typescript-basic-auth/

ydhnwb commented 1 year ago

This approach that extending routes class with RouteConfig make dependencies injection didnt work.

for example

class MyRoutes extends RouteConfig {
   private myController: MyController
   constructor(app: express.Application, myController: MyController){
        super(app, 'MyRoutes')
        this.myController = myController
   }

   configureRoutes(){
       THE this.myController will UNDEFINED here
   }
}

any solution for this?