简体   繁体   English

如何在我的应用程序中使用Keystone.js admin api(unauthed)?

[英]How to use the Keystone.js admin api (unauthed) in my app?

I was taking a look at this the docs on the admin api and realized that it perfectly solves my case of using Keystone to power a SPA. 我正在看看这个关于admin api的文档,并意识到它完美地解决了我使用Keystone为SPA提供动力的问题。 However, I can't figure out a way to access the admin api routes from the api routes that I'm building without forcing an auth event first. 但是,我无法找到一种方法来从我正在构建的api路由访问admin api路由,而不首先强制执行auth事件。

Anyone have suggestions for how I could accomplish this? 有人建议我如何才能做到这一点?

After a bit of trial and error I came to a solution that I'm pretty happy with. 经过一些反复试验后,我找到了一个我非常满意的解决方案。 I took a good look at keystone/admin/server/app/createDynamicRouter.js and copied the functionality from there, and also duplicated keystone/admin/server/middleware/initList.js. 我仔细查看了keystone / admin / server / app / createDynamicRouter.js并从那里复制了功能,还复制了keystone / admin / server / middleware / initList.js。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM