Skip to content

science-periodicals/api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API

CircleCI

styled with prettier

sci.pe Hypermedia API

Note: this module is auto published to npm on CircleCI. Only run npm version patch|minor|major and let CI do the rest.

Coding style

Use prettier --single-quote (or npm run format) and:

  • const over let or var whenever possible

Development

Be sure that CouchDB and Redis are running. To link see link.sh

For tests:

npm test

Documentation

See https://sci.pe/get-started/api.

API

import { api, assets } from '@scipe/api';

const app = express();

app.use(assets(config));
app.use(api(config));

Middlewares

addLibrarian

import { addLibrarian } from '@scipe/api';
import express from 'express';
const app = express();
app.get('/:id', addLibrarian, (req, res, next) => {
  req.pipe(req.librarian.db.get(req.params.id)).pipe(res);
});

acl

import { acl } from '@scipe/api';
import express from 'express';
const app = express();

app.get('/', acl(), (req, res, next) => {
  // user has access
});

License

@scipe/api is dual-licensed under commercial and open source licenses (AGPLv3) based on the intended use case. Contact us to learn which license applies to your use case.