<commit_before># bookshelf api

Bookshelf API is configurable Express middleware that allows you to serve a RESTful API from a directory of [Bookshelf.js](http://bookshelfjs.org/) models.

`npm install --save bookshelf-api`

Here's the basic usage:

```js
let express = require('express');
let api = require('bookshelf-api')({
	path: './models'
});

let app = express();
app.use('/api/v1', api);
```

This simple setup will provide you with your standard GET, POST, PUT and DELETE verbs for a RESTful API based on the Bookshelf models in your `./models` directory.

For example, imagine you have a product model that looks like this:

##### ./models/Product.js
```js
module.exports = bookshelf.Model.extend({
  tableName: 'products'
});
```

Using the setup above you will now be able to make API requests to `/api/v1/product`.

* `GET    /api/v1/product` - List all of the products.
* `GET    /api/v1/product/23` - Get the product with id 23.
* `POST   /api/v1/product` - Create a new product
* `PUT    /api/v1/product/7` - Update product with an id of 7.<commit_msg>Update README with better examples<commit_after># bookshelf api

Bookshelf API is configurable Express middleware that allows you to serve a RESTful API from a directory of [Bookshelf.js](http://bookshelfjs.org/) models.

`npm install --save bookshelf-api`

Here's the basic usage:

```js
let express = require('express');
let path = require('path');
let api = require('bookshelf-api')({
	path: path.join(__dirname, 'models')
});

let app = express();
app.use('/api/v1', api);
```

This simple setup will provide you with your standard GET, POST, PUT and DELETE verbs for a RESTful API based on the Bookshelf models in your `./models` directory.

For example, imagine you have a product model that looks like this:

##### ./models/Product.js
```js
module.exports = bookshelf.Model.extend({
  tableName: 'products'
});
```

Using the setup above you will now be able to make API requests to `/api/v1/product`.

* `GET    /api/v1/product` - List all of the products.
* `GET    /api/v1/product/23` - Get the product with id 23.
* `POST   /api/v1/product` - Create a new product
* `PUT    /api/v1/product/7` - Update product with an id of 7.
{'fraction_non_alphanumeric': 0.1287981859410431, 'fraction_numerical': 0.010884353741496598, 'mean_word_length': 3.7852494577006506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3533378', 'n_tokens_mistral': 727, 'n_tokens_neox': 678, 'n_words': 279}