在 node.js 中初始化 ||如何处理 node.js 中的初始配置

Initialization in node.js || How to handle initial configuration in node.js

我最近从 Java 过渡到 Java 脚本,特别是 MEAN 堆栈开发。我想在 node.js 中创建 API 以便它在部署时初始化所有配置,如 Servlet 中的 init 方法。

如果有任何其他标准化方法可以完成此任务,请指导我。

您可以查看 Swagger,它提供了许多用于配置、表示和验证 RESTful API.

的工具

有一个 swagger-node 模块,在定义您的 JSON API 架构后,可以自动为您配置 API。

您必须使用 Loopback 是一个高度可扩展的开源 Node.js API 框架。

特征

  • Quickly create dynamic end-to-end REST APIs.
  • Connect devices and browsers to data and services.
  • Use Android, iOS, and AngularJS SDKs to easily create client apps.
  • Add-on components for push, file management, 3rd-party login, and geolocation.
  • Use StrongLoop Arc to visually edit, deploy, and monitor LoopBack apps.
  • StrongLoop API Gateway acts an intermediary between API consumers (clients) and API providers to externalize, secure, and manage APIs.
  • Runs on-premises or in the cloud

如何安装 - 要安装它,只需运行以下给出的命令。

$ npm install -g strongloop

希望这有助于解决您的问题!!