npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

service-core

v3.0.2

Published

Core boiler plate code to install node server as windows service

Downloads

38

Readme

service-core

Service-Core is a project to faciliate running a node application in (semi-)production environment on a windows machine. Using Windows Services, Service-Core will register itself and autostart on startup and make sure the application is running. In addition it will take care of maintaining the application including auto updating it seamlessly.

Notice, linux support is coming soon.

The Core

The core provides methods for updating applications as well as taking care of restarting and installing and everything needed to have a pleasent experience running a node application in Windows. It auto checks github for new releases based on the repository specified in config.json.

The core supports running two applications by default (specified in config.json file):

  • The manage app: Designated UI node app to provide UI interface on top of service-core. Not needed as service-core already does everything by itself but nice to have to remotely read logs and manually trigger updates among other things
  • The main app: The main application service-core is designated to run.

Both the main app and manage app get regular update checks and will automatically be installed if a new version is detected.

API

To build a service-core application I recomennd checking out hello world app but in short, all service core applications require the following things:

  • index.mjs that exposes a function called start(config, db, log, core, http, port)
  • The application in question must use the passed on http parameter to call .createServer(). Otherwise service-core has no way of shutting it down to provide seamless updates among other things.

The start() function gets called with following parameters:

  • config: JSON object containing the entirety of config.json
  • db: A lowdb database available for the application to use. Also used internally in service-core to manage versions.
  • log: A bunyan logger for logging.
    • log.event.info,warn,error(message): Write a log message to the windows event viewer.
  • core: The internal core. Exposes multiple methods for managing service-core
  • http: A wrapped internal node http to call .createServer(). Allows service-core to monitor the server in question.
  • port: The port the application should be listening to.