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

human-connection-api-nodejs-client

v0.0.1

Published

Human Connection Node.js API Client

Downloads

2

Readme

human-connection-api-nodejs-client

Build Status

Prerequisites

Make sure you have a recent version of NodeJS (> v10) and yarn.

Usage

We're using cucumber-js for testing. Cucumber is a self-documenting testing framework, so going through the features should give a good idea how to use this library. E.g. if you want to learn how to create a contribution for an organization, check out this feature.

Here is an example of my first post in Human Connection:

const hc = require('human-connection-api-nodejs-client');
// hc.connect('https://api-alpha.human-connection.org'); // current alpha backend URL
hc.connect('http://localhost:3030'); // for local development
let user = new hc.User({
  email: '[email protected]',
  password: '1234'
});
let contributionParams = {
  title: 'Hier gibt\'s die erste 3rd party library für Human Connection',
  content: 'Für alle die gerne automatisiert Beiträge auf Human Connection posten möchten, gibt es jetzt eine Software-Bibliothek namens <em>human-connection-api-nodejs-client</em>. Zurzeit kann man Beiträge erstellen oder updaten wenn es sie schon gibt. Der Quellcode ist natürlich öffentlich auf <a href="https://github.com/demokratie-live/human-connection-api-nodejs-client">Github</a> verfügbar.<br>Viel Spaß beim Posten!',
  contentExcerpt: 'Für alle die gerne automatisiert Beiträge auf Human Connection posten möchten, gibt es jetzt eine Software-Bibliothek',
  type: 'post',
  language: 'de'
};
user.contribute(contributionParams, {
  slug: 'erste-3rd-party-library-fuer-human-connection',
  resolveSlugs: {
    categories: ['justforfun', 'cooperation-development', 'education-sciences']
  }
});

Testing

The development environment of this plugin uses the backend API of Human Connection as a git submodule.

Check out the code with:

git clone --recurse-submodules https://github.com/demokratie-live/human-connection-api-nodejs-client.git
cd human-connection-api-nodejs-client

Install dependencies with yarn:

yarn install
cd API
yarn install
cd ..

Starting the backend of Human Connection will create a database configuration if it does not exist. The default configuration has the database seeder enabled, which is not what you want for testing. You can avoid the database seeder by copying a database configuration used on our build server to the backend folder:

cp local.travis.json API/config/local.json

Make sure there is no other HC backend running. Then start the test suite:

yarn test

In our tests we spawn an instance of the backend and run tests against it. If spawn does not recognize the location of your local node executable, you can pass an environment variable like this:

NODE_PATH=$(which node) yarn test

Development

I would suggest that you create a cucumber-js feature before you implement your desired feature. For debugging I set breakpoints with debugger somewhere in the code, run

node --inspect node_modules/cucumber/bin/cucumber-js features/your.feature

and open the dedicated DevTools for Node in chromium.

When you're done, run:

yarn lint

There is also an API documentation for Human Connection that you might find useful.