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

seguir-express-middleware

v0.1.7

Published

Experss middleware for seguir self-hosted social network backend and API

Downloads

10

Readme

Seguir Express Middleware

Part of the Seguir social platform, used to quickly create your own application that uses seguir as a backend.

http://cliftonc.github.io/seguir/server

Server API

Middleware

This is express middleware that you can add to your own application, that will expose a set of local endpoints that you can use to build a front end for Seguir.

We have done it this way to enable you to wire up whatever authentication mechanism you like for users, with the only requirement being that the request hits the seguir middleware with a req.user object that has a seguirID (this can be over-ridden).

req.user = {
  seguirId: '92029c7b-0ded-4d4f-b782-b2514c3dbb47'
}

Adding to your application

Assuming your express app is running on /app, you can add the endpoints via:

var express = require('express');
var Seguir = require('seguir/client');
var seguir = new Seguir(config);
var seguirMiddleware = require('seguir-express-middleware');
var authMiddleware = function(req, res, next) {
  // example middleware to retrieve seguirId for your use case
  req.user.seguirId = getSeguirIdFromRequest(req);
  next();
}
app.use('/social', seguirMiddleware(options, express, seguir, authMiddleware));

Configuration options

You can over ride the userProperty (e.g. req.user), along with the seguirId property req.user.seguirId.

Additionally, you can switch off the elements of the api that you do not want to use. All are on by default.

{
  userProperty: 'user',
  seguirIdProperty: 'seguirId',
  user: true,
  post: true,
  friend: true,
  follow: true,
  like: true,
  feed: true
}

Docs

npm run docs

This will create API documents in /docs.

git subtree push --prefix doc origin gh-pages

This will push any documentation changes to gh-pages.