Giter Club home page Giter Club logo

bookshelf-api's Issues

example not work for me

I'm use node 6.2.0 win10 I'm test by you example /api/v1/product is not work
it say Not Found 404

but in custom route is work app.get('/api/v1/product', api('Product'))

please help me

Thanks.

Add the ability to support result record limits

Similarly to the way that you can filter with where clauses and pull related models, it would be nice to be able to specify result limit and offset via query params. It would also be great to be able to specify a hard maximum limit in the middleware configuration options so that you can't query millions of records

If a bookshelf model does not have timestamps an error is thrown

<h1>model.hasTimestamps.indexOf is not a function</h1>
<h2></h2>
<pre>TypeError: model.hasTimestamps.indexOf is not a function
   at module.exports (/Users/admin/tiy/final-project/node_modules/bookshelf-api/dist/get.js:7:26)
   at /Users/admin/tiy/final-project/node_modules/bookshelf-api/dist/middleware.js:46:11
   at Layer.handle [as handle_request] (/Users/admin/tiy/final-project/node_modules/express/lib/router/layer.js:95:5)
   at trim_prefix (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:312:13)
   at /Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:280:7
   at Function.process_params (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:330:12)
   at next (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:271:10)
   at module.exports (/Users/admin/tiy/final-project/lib/middleware/logged-in.js:8:3)
   at Layer.handle [as handle_request] (/Users/admin/tiy/final-project/node_modules/express/lib/router/layer.js:95:5)
   at trim_prefix (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:312:13)
   at /Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:280:7
   at Function.process_params (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:330:12)
   at next (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:271:10)
   at Function.handle (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:176:3)
   at router (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:46:12)
   at Layer.handle [as handle_request] (/Users/admin/tiy/final-project/node_modules/express/lib/router/layer.js:95:5)
   at trim_prefix (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:312:13)
   at /Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:280:7
   at Function.process_params (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:330:12)
   at next (/Users/admin/tiy/final-project/node_modules/express/lib/router/index.js:271:10)
   at SessionStrategy.strategy.pass (/Users/admin/tiy/final-project/node_modules/passport/lib/middleware/authenticate.js:325:9)
   at /Users/admin/tiy/final-project/node_modules/passport/lib/strategies/session.js:65:12</pre>

Problem using UUIDs

I'm using UUIDs as IDs in my models. When I make a GET request with an id (e.g. user/:id) and the UUID starts with a number, the related objects (oneToMany) aren't loaded. It works when the UUID starts with a letter.

I'm guessing, that somewhere the ID is converted to a number.

Add the ability to specify result order

Similarly to the way that you can filter with where clauses and pull related models, it would be nice to be able to specify result order via query params

Add the ability to support pluralized routes

Right now models, database table and route pluralization is inconsistent:

For example:

db table: products
model: Product
endpoint: /api/v1/product

I've had requests to allow the route to be pluralized. For example:

endpoint: /api/v1/products or /api/v1/products/1

This should be added as an option to the configuration file:

let api = require('bookshelf-api')({
path: path.join(__dirname, 'models'),
pluralEndpoints: true
});

A quick look shows that this might be helpful: https://github.com/blakeembrey/pluralize

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.