open-index/open-npm huggingface dataset:
npm package: @nodebb/socket.io-adapter-mongo
Description: [![Build Status](https://secure.travis-ci.org/modit/socket.io-adapter-mongo.png)](http://travis-ci.org/modit/socket.io-adapter-mongo) [![NPM version](https://badge.fury.io/js/socket.io-adapter-mongo.png)](http://badge.fury.io/js/socket.io-adapter-mongo)
Latest version: 3.1.1

# socket.io-adapter-mongo

[![Build Status](https://secure.travis-ci.org/modit/socket.io-adapter-mongo.png)](http://travis-ci.org/modit/socket.io-adapter-mongo)
[![NPM version](https://badge.fury.io/js/socket.io-adapter-mongo.png)](http://badge.fury.io/js/socket.io-adapter-mongo)

*This module is modified from [socket.io-redis](https://github.com/Automattic/socket.io-redis)

Update 5/31/2017 - Versions prior to 1.0 allowed an object to be passed which was used to build a URI. This caused problems when using replica sets and caused warnings when MongoDB change the client API. In the interest of simplicity and futureproofing the internal URI construction has been eliminated and it is now required that a valid mongo URI be passed.

## How to use

```js
var io = require('socket.io')(3000);
var mongoAdapter = require('socket.io-adapter-mongo');
io.adapter(mongoAdapter( 'mongodb://localhost:27017' ));
```

By running socket.io with the `socket.io-adapter-mongo` adapter you can run
multiple socket.io instances in different processes or servers that can
all broadcast and emit events to and from each other.


## API

### adapter(uri[, opts])

`uri` is a string that matches a mongodb connection string
```
mongodb://localhost:27017/test
mongodb://user:pass@localhost:27017/test
mongodb://user:pass@host1:27017,host2:27017,host3:27017/test
```

### adapter(opts)

The following options are allowed:

- `key`: the name of the key to pub/sub events on as prefix (`socket.io`)
- `socket`: unix domain socket to connect to mongo (`"/tmp/mongo.sock"`). Will
  be used instead of the mongo URI if specified.
- `client`: optional, the mubsub client to publish events on

If you decide to supply a client, make sure you use [mubsub](https://github.com/nodebb/mubsub) as a client or one with an equivalent API.
## Running tests
Stat mongo, thenopen the `test` db
    mongo> use test
And create a new user
    mongo> db.createUser({ user: "test", password: "test", roles: [ "readWrite" ] })
Then run the tests
    npm test

## License

MIT
npm package: @nodebb/spider-detector
Description: A tiny node module to detect spiders/crawlers quickly and comes with optional middleware for ExpressJS
Author: Michael Heuberger
Latest version: 2.0.3

# spider-detector

[![Build Status](https://travis-ci.org/binarykitchen/spider-detector.svg?branch=master)](https://travis-ci.org/binarykitchen/spider-detector) [![npm version](https://badge.fury.io/js/spider-detector.svg)](https://badge.fury.io/js/spider-detector)

A tiny node module to detect spiders/crawlers quickly and comes with optional middleware for ExpressJS

It might be useful when you have a single page app but want to deliver static pages for spiders.

## Install

```
npm install spider-detector // or `yarn install spider-detector`
```

## Direct Example

```js
const detector = require('spider-detector')
detector.isSpider('baiduspider') // return true
```

## ExpressJS example

```js
const detector = require('spider-detector')
const express = require('express')
const app = express()

app.use(detector.middleware())

app.get('/*', function(req, res) {
  if (req.isSpider()) {
    // do something else, i.E. send a static page
  } else {
    // send single page app
  }
})
```

## Why? There are already modules out there

Well, I wanted one which does not use `readFileSync` and comes with optional middleware. Furthermore some hackers do not classify Googlebot as a spider anymore which poses a problem sometimes, see next question.

## What about Googlebot?

Yep, Googlebot is able to deal with single page apps but this feature is pretty unstable. Especially under AngularJS when hash fragments are disabled with `$locationProvider.html5Mode(true)`. That's why - against all odds - I have classified `googlebot` as a spider in this module.