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

leylines-server

v3.2.2

Published

NodeJS server for leylines, consisting of a CORS proxy, proj4 CRS lookup service, ogr2ogr conversion service, and express static server.

Downloads

3

Readme

LeylinesJS-Server

Greenkeeper badge

Build Status

This is a basic NodeJS Express server that serves up a (not included) static TerriaJS-based site (such as National Map) with a few additional useful services:

  • /api/v1/proxy: a proxy service which applies CORS headers for data providers that lack them. Add URLs to config.json to enable them.
  • /api/v1/proj4def: a proj4 coordinate reference system lookup service.
  • /api/v1/convert: an ogr2ogr server-side conversion service.
  • /api/v1/proxyabledomains: return a JSON of domains the server is willing to proxy for
  • /api/v1/ping: returns 200 OK.
  • /api/v1/share/X-Y (GET): uses prefix X to resolve key Y against some configured JSON storage provider (Gist and AWS S3 implemented)
  • /api/v1/share (POST): stores a piece of JSON with a configured storage provider (Gist implemented)
  • /api/v1/serverconfig: retrieve (safe) information about how the server is configured.
  • All other requests are served from the wwwroot directory you provide on the command line, which defaults to ./wwwroot
  • If files [wwwroot]/404.html and/or [wwwroot]/500.html exist, they will be served for those HTTP error codes.
  • Supports very simple authentication via a single username/password included in requests using HTTP basic authentication.
  • Proxied services that require HTTP authentication can be proxied by adding credentials to a proxyauth.json file.
  • It can be run in HTTPS mode, although there are better ways of doing that in production.

Generally, you don't want to manually install TerriaJS-Server. It comes installed with TerriaMap (see below).

Stand-alone installation (without serving TerriaMap)

Install

  1. git clone https://github.com/terriajs/terriajs-server
  2. cd terriajs-server
  3. npm install

Configure

Copy serverconfig.json.example to serverconfig.json and configure as needed. See comments inside that file. (Comments are allowed; see json5.org).

If you want to proxy authenticated layers, do the same for proxyauth.json.example.

TerriaJS-Server is run through PM2, a process manager which handles automatic restarting, logging and load balancing. The default configuration is for a development environment with a single process. To use multiple processes, modify the configuration in ecosystem.config.js.

Run

  1. npm start -- [options] [path/to/wwwroot]
terriajs-server.js [options] [path/to/wwwroot]

Options:
  --port         Port to listen on.                [default: 3001]      [number]
  --public       Run a public server that listens on all interfaces.
                                                       [boolean] [default: true]
  --config-file  File containing settings such as allowed domains to proxy. See
                 serverconfig.json.example
  --proxy-auth   File containing auth information for proxied domains. See
                 proxyauth.json.example
  --verbose      Produce more output and logging.     [boolean] [default: false]
  --help, -h     Show this help.                                       [boolean]

For example, to run with port 3009:

npm start -- --port 3009

To run the server in the foreground, you can do this:

node . [arguments as above]

Tests

  1. Run npm test

Installation with TerriaMap

Just install TerriaMap. TerriaJS-Server is installed to node_modules/terriajs-server, and you can run it manually as node_modules/terriajs-server ./wwwroot.