[英]Load multiple versions of a package in npm
I am setting up a web API and I'd like to offer multiple versions of the underlying library. 我正在设置一个Web API,我想提供底层库的多个版本。
In short, I'd like to call it with: http://myapi/xyz/method where xyz is the version of the underlying library I'm using. 简而言之,我想用它来调用: http:// myapi / xyz / method其中xyz是我正在使用的底层库的版本。
I'm using npm to handle my libraries and seem to be able to specify only one version of the dependencies. 我正在使用npm来处理我的库,似乎只能指定一个版本的依赖项。
I thought about manually downloading each versions in sub folders of my service but I'm not a big fan of it. 我想过手动下载我服务的子文件夹中的每个版本,但我不是它的忠实粉丝。 Instead, I'd like to just have a list of allowed versions in my config and that it loads them at service start-up for future use.
相反,我想在我的配置中只列出允许的版本,并在服务启动时加载它们以备将来使用。
What's the best way to achieve multi-versions API on a JavaScript web service? 在JavaScript Web服务上实现多版本API的最佳方法是什么? I'm open to other package managers as well (instead of npm).
我也对其他包经理开放(而不是npm)。
i hope to help, if you want to use different versions, eg express: 我希望能提供帮助,如果你想使用不同的版本,例如express:
"devDependencies": {
"express": "~3.x",
}
So you will tell no matter npm express version you use, always be from the version "3" 所以无论你使用npm express版本你都会告诉你,总是来自版本“3”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.