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-template-node

v0.7.0

Published

A blueprint for MediaWiki REST API services

Downloads

19

Readme

service-template-node Build Status

Template for creating MediaWiki Services in Node.js

Getting Started

Installation

First, clone the repository

git clone https://github.com/wikimedia/service-template-node.git

Install the dependencies

cd service-template-node
npm install

You are now ready to get to work!

  • Inspect/modify/configure app.js
  • Add routes by placing files in routes/ (look at the files there for examples)

You can also read the documentation.

Running the examples

The template is a fully-working example, so you may try it right away. To start the server hosting the REST API, simply run (inside the repo's directory)

npm start

This starts an HTTP server listening on localhost:6927. There are several routes you may query (with a browser, or curl and friends):

  • http://localhost:6927/_info/
  • http://localhost:6927/_info/name
  • http://localhost:6927/_info/version
  • http://localhost:6927/_info/home
  • http://localhost:6927/{domain}/v1/siteinfo{/prop}
  • http://localhost:6927/{domain}/v1/page/{title}
  • http://localhost:6927/{domain}/v1/page/{title}/lead
  • http://localhost:6927/ex/err/array
  • http://localhost:6927/ex/err/file
  • http://localhost:6927/ex/err/manual/error
  • http://localhost:6927/ex/err/manual/deny
  • http://localhost:6927/ex/err/auth

Tests

The template also includes a test suite a small set of executable tests. To fire them up, simply run:

npm test

If you haven't changed anything in the code (and you have a working Internet connection), you should see all the tests passing. As testing most of the code is an important aspect of service development, there is also a bundled tool reporting the percentage of code covered. Start it with:

npm run-script coverage

Troubleshooting

In a lot of cases when there is an issue with node it helps to recreate the node_modules directory:

rm -r node_modules
npm install

Enjoy!