Socket
Socket
Sign inDemoInstall

seguir-express-middleware

Package Overview
Dependencies
2
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    seguir-express-middleware

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


Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 25 May 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc