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

@sndo/nats-nest

v0.4.2

Published

A lightweight wrapper around an embedded NATS server

Downloads

420

Readme

nats-nest

nats-nest is a thin wrapper around an embedded NATS server in a Go module. A server can be started through the command-line or using the NatsServer class, which basically just invokes the nats-server executable.

Installation

npm install @sndo/nats-nest

CLI Usage

A NATS server can be started like so:

npx nats-nest

NatsServer Usage

A NatsServer class can also be used to start a server.

import { NatsServer } from 'nats-nest'

const server = new NatsServer()

// The options are optional
await server.start({
  host: '127.0.0.1',
  port: 4222,
  name: 'NATS_Server',
  jetstream: true,
})

// Stopping the server
await server.stop()

Configuration Options

Server config options can also be set when starting the server.

| Field | Type | Flag(s) | Environment Variable | Default | Help | | ----------- | -------- | ----------------- | ---------------------- | --------- | ----------------------------------------------------------------- | | Host | string | -h, --host | NATS_NEST_HOST | 0.0.0.0 | Host on which the NATS server will listen | | Port | int | -p, --port | NATS_NEST_PORT | 4222 | Port on which the NATS server will listen | | HTTPPort | int | -m, --http-port | NATS_NEST_HTTP_PORT | | HTTP port for monitoring dashboard (exclusive of --https-port) | | HTTPSPort | int | --https-port | NATS_NEST_HTTPS_PORT | | HTTPS port for monitoring dashboard (exclusive of --httpx-port) | | Name | string | -n, --name | NATS_NEST_NAME | | Server name | | PidFile | string | -P, --pid | NATS_NEST_PID | | File to write the server's PID | | Config | string | -c, --config | NATS_NEST_CONFIG | | Path to configuration file | | LogFile | string | -l, --log | | | File to redirect log output | | NoLog | bool | --no-log | NATS_NEST_NO_LOG | | Disable logging | | Debug | bool | -D, --debug | NATS_NEST_DEBUG | | Enable debug mode | | Syslog | bool | -s, --syslog | | | Log to syslog or windows event log | | Jetstream | bool | --jetstream | | | Enable JetStream functionality | | StoreDir | string | --store_dir | | | Set the storage directory |

Examples:

Setting a name and enabling Jetsream

npx nats-nest --name "MyNatsServer" --jetstream

Setting the port and host

npx nats-nest --port 4222 --host 127.0.0.1