json-server icon indicating copy to clipboard operation
json-server copied to clipboard

Feat: Support for bulk insertion

Open b4dnewz opened this issue 6 years ago • 6 comments

Added support for bulk insertion when posting array to plural and nested routes.

POST /posts 
POST /posts/1/comments

When a single object is posted it work as usual, when an array (of objects) is posted it will perform bulk insertion.

Also the id field is parsed into number to fix match issues, see #396

b4dnewz avatar Mar 19 '19 12:03 b4dnewz

@typicode could we get this feature merged?

Alewex avatar Jun 14 '19 18:06 Alewex

Any updates on when this may get merged?

jameskirkpatrick23 avatar Jun 26 '19 14:06 jameskirkpatrick23

I completely forgot that id can be non numeric also.. I'll update this and put some tests for that too, thanks!

We actually needed the fix really badly, so we created our own fix. See: https://github.com/NavaraBV/json-server/commit/699c27e82e33d08aceef5fa8fc53dd6cd7070ec7

(somehow the test that is commented out there was failing on my machine, you can ignore that change)

wilgert avatar Aug 16 '19 07:08 wilgert

LGTM now!

wilgert avatar Aug 20 '19 08:08 wilgert

Any reason why this hasn't been merged yet?

alesmit avatar May 08 '20 07:05 alesmit

Will this be merged soon?

Saunved avatar Jul 06 '20 05:07 Saunved