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

rest-on-couch

v16.0.1

Published

Interface to CouchDB that allows the control of permissions on the documents

Downloads

177

Readme

rest-on-couch

NPM version build status codecov npm download

Interface to CouchDB that allows the control of permissions on the documents.

REST API

API documentation

Configuration

The configuration is being read on load from many sources, in the following order (ascending priority):

  1. Default configuration. Some configuration elements have default values. They are defined in the source code
  2. Main configuration file (config.js or config.json in ROC's home directory)
  3. Database configuration file (config.js in database's subdirectory)
  4. Environment variable (uppercase snake-case with REST_ON_COUCH_ prefix)
  5. Custom config file passed with --config in the CLI

Main options

url

Type: string
Default: 'http://localhost:5984'
URL of the CouchDB server.

username

Type: string
Default: undefined
Username for CouchDB connection.

password

Type: string
Default: undefined
Password for CouchDB connection.

logLevel

Type: string
Default: 'WARN'
Level of the logs stored in the database. Possible values are FATAL (1), ERROR (2), WARN (3), INFO (4), DEBUG (5) and TRACE (6). Logs are only inserted if the current level is equal or higher to the log's level.

authRenewal

Type: number
Default: 570
Time in seconds that the application waits before revalidating the session with CouchDB. This number should be smaller than the session's cookie life.

Server options

port

Type: number
Default: 3000
Port used by the rest-on-couch server.

auth

Type: object
Default: {couchdb:{}}
Object describing the authentication strategies that are available and providing options to them.

proxy

Type: boolean
Default: true
Set to true if your application is behind a proxy and needs to trust X-Forwarded- headers.

proxyPrefix

Type: string
Default: '/'
If the proxy is not at the root level of the URL, set this value to the corresponding prefix.

allowedOrigins

Type: array<string>
Default: []
If cross-origin calls need to be done, set the list of trusted origins here.

sessionDomain

Type: string
Default: undefined
Domain of the session cookie.

sessionKey

Type: string Default: 'roc:sess' Key of the session cookie.

sessionPath

Type: string Default: '/' Path of the session cookie.

sessionSecure

Type: boolean
Default: false
Set to true if the cookie should only be valid on secure URLs.

sessionSameSite

Type: string Default: 'lax' Value of the "SameSite" cookie option. Set to 'strict', 'lax', or 'none'.

debugrest

Type: boolean
Default: false
If set to true, a stack trace will be print to the body of the response when an error occurs.
Do not use this in production!

Zenodo options

zenodo

Type: boolean
Default: false If set to true, enables the Zenodo API.

zenodoName

Type: string
Name of this application/database. This will be used in the keywords for each entry that is created. For example, if zenodoName is 'db123', entries will contain the keyword 'from:db123'.
This option is mandatory if zenodo is true.

zenodoToken

Type: string
API token for Zenodo.
This option is mandatory if zenodo is true.

zenodoSandboxToken

Type: string
API token for Zenodo's sandbox.

zenodoVisualizationUrl

Type: string
URL prefix for entry visualization. If set, the Zenodo entry ID will be appended to this, optionally with a ?sandbox=1 query string. A link will be added at the end of the entry's description.

zenodoReadme

Type: string
Default contents of the _README.md that is published in the Zenodo entry.

zenodoAttachments

Type: function
Function that is called with each ROC entry's contents and must return a list of attachments to add to the Zenodo entry. It can also return an object if a single attachment is to be added

function zenodoAttachments(content) {
  if (content.general && content.general.molfile) {
    return {
      filename: 'molfile.mol',
      contentType: 'chemical/x-mdl-molfile',
      data: content.general.molfile,
    };
  } else {
    return [];
  }
}

Setup environment with Docker (for running tests)

docker-compose up -d

Go to http://localhost:5984/_utils/#setup

  • Single node
  • username: admin, password: admin
  • bind address: 0.0.0.0
  • Execute the bash script /setupDatabase.sh
  • Execute the tests: npm t

Automatic importation

rest-on-couch is able to watch folders and to automatically import data in the database.

A specific userguide is available here.

License

MIT