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

geoserver-node-client

v1.4.4

Published

Node.js client for GeoServer REST API

Downloads

266

Readme

GeoServer Node Client

npm version Website GitHub Release Date GitHub last commit CI Badge

GeoSever Node Client Logo

Node.js / JavaScript Client for the GeoServer REST API.

API-Docs

Detailed API-Docs are automatically created with JSDoc.

Meta information

Compatible with GeoServer

  • v2.25.x
  • v2.24.x
  • v2.23.x (no more maintained and officially deprecated)
  • v2.22.x (no more maintained and officially deprecated)
  • v2.21.x (no more maintained and officially deprecated)
  • v2.20.x (no more maintained and officially deprecated)
  • v2.19.x (no more maintained and officially deprecated)
  • v2.18.x (no more maintained and officially deprecated)
  • v2.17.x (no more maintained and officially deprecated)

Usage

npm i geoserver-node-client

usage with require (ES5):

var grcImport = require('geoserver-node-client');
var GeoServerRestClient = grcImport.GeoServerRestClient;

var url = 'http://localhost:8080/geoserver/rest/';
var user = 'admin';
var pw = 'geoserver';
var grc = new GeoServerRestClient(url, user, pw);

function main () {
    grc.about.exists().then(function (result) {
      console.log(result);
    });
};

main();

usage as ES module (ES6)

import {GeoServerRestClient} from 'geoserver-node-client';

const url = 'http://localhost:8080/geoserver/rest/';
const user = 'admin';
const pw = 'geoserver';
const grc = new GeoServerRestClient(url, user, pw);

async function main () {
    const result =  await grc.about.exists();
    console.log(result);
};

main();

Setup

Run as local checkout (mainly for development purposes)

git clone https://github.com/meggsimum/geoserver-node-client

cd geoserver-node-client

npm install

npm run demo

Error Handling

A request either succeeds or throws the custom GeoServerResponseError. It has the standard message property with a "human-readable" text. Additionally the error has the property geoServerOutput which contains the direct response from GeoServer. This output is not guaranteed to exist and can either be a simple text or a complete HTML document. The latter is difficult to read, but might still be helpful for debugging. This example shows how these error properties can be used. It also shows how to filter by error type:

  try {
      // call any function from this library
      await grc.styles.publish(workspace, styleName, sldBody)
    } catch (error) {
      // the standard error message
      console.error(error.message);

      // the whole error including stack trace and (if available) the property 'geoServerOutput'
      console.error(error);

      if (error instanceof GeoServerResponseError) {
        // a GeoServer specific error happened
      } else {
        // another error happened
      }
    }

Unit Tests

First start a test setup using this Docker compose file:

docker-compose -f test/docker-compose.yml up

Then, in an other terminal, run:

# specify the GeoServer version and run the test suite
GEOSERVER_VERSION=2.20.4 npm run test

Release

Setting a git tag and increasing the version in the package.json as well as releasing to npm is done via release-it.

The GitHub release has to be performed manually based on the tag created by release-it.

This is the workflow for releasing:

  1. Make sure a GITHUB_TOKEN is available as environment variable. See here for more information.
export GITHUB_TOKEN=ADD-YOUR-TOKEN-HERE
  1. Make sure you are logged in to npm and ensure you have the rights to make a release.
npm login
# then enter your credentials
  1. Locally checkout the latest master branch that you would like to release, then run:
npm run release
  1. Follow the questions in the commandline.
  • automatically upgrades the version in package.json
  • makes a release commit and pushes it to GitHub
  • publishes the new version to npm

Who do I talk to?

  • meggsimum (Christian Mayer) - info __at## meggsimum ~~dot** de

Credits

This project was initiated by meggsimum within the mFund research project SAUBER and is further developed in the mFund research project KLIPS: