service-starter
标准化nodejs程序的结构体系。提供一个通用的启动和关闭程序的方式。兼容Docker。使用Typescript编写。
Last updated 2 years ago by wujingtao .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install service-starter 
SYNC missed versions from official npm registry.

service-starter

标准化js程序的结构体系。提供一个通用的启动和关闭程序的方式。兼容Docker。使用Typescript编写。

安装

npm i service-starter && npm i @types/component-emitter -D

程序结构

一个容器是由一个ServicesManager和多个ServiceModule所组成的。

ServicesManager

一个进程之中只能允许实例化一个ServicesManagerAPI)。该类负责:

  • 按照服务注册的顺序来启动服务
  • 响应容器的健康检查
  • 按照服务注册相反的顺序来关闭服务
  • 打印服务启动和关闭的过程
  • 优雅处理程序未捕获异常(发生异常后,先依次停止服务,再退出程序)
  • 处理系统退出信号,收到退出信号后,先依次停止服务,再退出程序
  • 提供了onError回调,用户可以自定义运行时错误处理方式

ServiceModule

规范了一个服务的基本结构(API

docker

在该项目docker文件夹下提供了一个Dockerfile基础配置模板

Current Tags

  • 3.0.2                                ...           latest (7 days ago)

33 Versions

  • 3.0.2                                ...           7 days ago
  • 3.0.1                                ...           8 days ago
  • 3.0.0                                ...           19 days ago
  • 2.1.0                                ...           a month ago
  • 2.0.1                                ...           4 months ago
  • 2.0.0                                ...           4 months ago
  • 1.1.3                                ...           4 months ago
  • 1.1.2                                ...           9 months ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.9                                ...           2 years ago
  • 0.2.8                                ...           2 years ago
  • 0.2.7                                ...           2 years ago
  • 0.2.6                                ...           2 years ago
  • 0.2.5                                ...           2 years ago
  • 0.2.3                                ...           2 years ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 45
Last Day 0
Last Week 29
Last Month 21
Dependencies (3)
Dev Dependencies (11)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |