Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
894 views
in Technique[技术] by (71.8m points)

nestjs - 多个项目中的NestJS重用/共享Auth保护(NestJS Reuse/Share Auth guards in multiple projects)

How to share my auth guards across multiple projects?

(如何在多个项目中共享我的身份验证防护?)

I have created my auth guards from the NestJS documentation and it all works wonderfully.

(我已经从NestJS文档中创建了我的身份验证防护,并且所有功能都很棒。)

I'd like to reuse them in all my services, but would like to avoid copy and pasting.

(我想在所有服务中重用它们,但要避免复制和粘贴。)

Sharing my implementation would be a preferred method.

(共享我的实现将是首选方法。)

Bit: This appears like a good way to do this but seemed like a front end component sharing solution only.

(位:这似乎是执行此操作的好方法,但似乎仅是前端组件共享解决方案。)

NPM + Lerna: I'm currently reading up on this approach but I'm not sure if this is the best method.

(NPM + Lerna:我目前正在阅读这种方法,但是我不确定这是否是最好的方法。)

The below structure shows the config service that I'd also like to pull out into a private library that my core services could use as well as the auth library.

(下面的结构显示了配置服务,我也想将其提取到我的核心服务可以使用的私有库以及auth库中。)

当前结构

  ask by S. Vincent translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...