1.0.1 • Published 6 years ago

ping-lazymention v1.0.1

Weekly downloads
2
License
LGPL-3.0+
Repository
github
Last release
6 years ago

ping-lazymention

Build Status Coverage Status npm Greenkeeper badge

Ping a lazymention server

Originally designed as a gulp task, but is useful otherwise too.

Installation

npm install ping-lazymention

Usage

The function exported by the module takes two arguments. The first is the full URL to a lazymention API endpoint. The second is the URL you want to submit for processing.

When you call the module, it will return a new function configured with the two URLs. This second function takes one parameter, a callback function that will be invoked when the lazymention server has been (un)successfully pinged. This second function is designed to be a gulp task but it's not really tied to gulp.

The module logs stuff to the console. This is nice if you're using gulp and probably annoying otherwise. I would take PRs to improve this situation, for example by adding an options object argument with a quiet option.

Example

Example inside a gulpfile.js:

var gulp = require('gulp');
var ping = require('ping-lazymention');

gulp.task('ping', ping('http://example.com:21507/jobs/submit', 'https://example.com/blog/'));

This example assumes that you have lazymention running on example.com:21507, and your blog that you want it to crawl is at https://example.com/blog/. Note that we've specified the full path to the API (i.e. /jobs/submit) in the first URL.

License

LGPL 3.0+

Author

AJ Jordan alex@strugee.net