Skip to content

Commit

Permalink
Merge pull request #28 from hapipal/v3
Browse files Browse the repository at this point in the history
V3, take 2. Moved master->main and re-running merge to make sure CI works as expected.
  • Loading branch information
mattboutet authored Apr 4, 2021
2 parents f9af570 + aff47d5 commit 73cbf4b
Show file tree
Hide file tree
Showing 8 changed files with 403 additions and 693 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "@hapi/eslint-config-hapi",
"parserOptions": {
"ecmaVersion": 9
}
}
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ Auto-generated, RESTful, CRUDdy route handlers

Lead Maintainer - [Matt Boutet](https://github.com/mattboutet)

## Installation
```sh
npm install @hapipal/tandy
```

> **Note**
>
> This plugin is intended to work with [hapi](https://github.com/hapijs/hapi) v19+ and its [Objection ORM](https://github.com/Vincit/objection.js/) plugin, [schwifty](https://github.com/BigRoomStudios/Schwifty/).
> This plugin is intended to work with [hapi](https://github.com/hapijs/hapi) v19+ and its [Objection ORM](https://github.com/Vincit/objection.js/) plugin, [schwifty](https://github.com/hapipal/schwifty).
## What it does
Tandy registers route handlers based upon the `method` and `path` of your route. It turns them into RESTful API endpoints that automatically interact with models defined through Schwifty. By default Tandy will infer which models to use from the request path. The route handler is based on one of eight Tandys:
Expand Down Expand Up @@ -126,7 +131,7 @@ These options allow you to act on behalf of the authenticated user. Typically t

- `where` (string). Applies to `find`.

Extracts only those records that fulfill a specified condition. (i.e. `createdDate = '2019-08-19'`)(overridden by `where` query parameter).
Extracts only those records that fulfill a specified condition. (i.e. `createdDate = '2019-08-19'`)(overridden by `where` query parameter).

## Usage
Here's an (over)simplified example.
Expand Down
5 changes: 4 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ const internals = {};
exports.plugin = {
pkg: Package,
once: true,
requirements: {
hapi: '>=19'
},
register: function (server, options) {

server.dependency('schwifty');
server.dependency('@hapipal/schwifty');

server.decorate('handler', 'tandy', (route, handlerOptions) => {

Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tandy",
"version": "2.0.1",
"name": "@hapipal/tandy",
"version": "3.0.0",
"description": "Auto-generated, RESTful, CRUDdy route handlers for Schwifty models in hapi",
"main": "lib/index.js",
"scripts": {
Expand Down Expand Up @@ -32,23 +32,23 @@
"@hapi/call": "8.x.x",
"@hapi/hoek": "9.x.x",
"joi": "17.x.x",
"lodash": "^4.17.20"
"lodash": "^4.17.21"
},
"peerDependencies": {
"@hapi/hapi": ">=19",
"schwifty": "5.x.x"
"@hapi/hapi": ">=19 <21",
"@hapipal/schwifty": "6.x.x"
},
"devDependencies": {
"@hapi/code": "8.x.x",
"@hapi/eslint-config-hapi": "13.x.x",
"@hapi/eslint-plugin-hapi": "4.x.x",
"@hapi/hapi": "20.x.x",
"@hapi/hapi": ">=20",
"@hapi/lab": "24.x.x",
"coveralls": "3.x.x",
"eslint": "7.x.x",
"knex": "0.21.6",
"knex": "0.95.4",
"objection": "2.x.x",
"schwifty": "5.x.x",
"@hapipal/schwifty": "6.x.x",
"sqlite3": "5.x.x"
},
"homepage": "https://github.com/hapipal/tandy"
Expand Down
Loading

0 comments on commit 73cbf4b

Please sign in to comment.