From 175604802db36438af8cdd84a7d30080609a021e Mon Sep 17 00:00:00 2001 From: Gildas Garcia <1122076+djhi@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:19:30 +0200 Subject: [PATCH] Add upgrade guide --- UPGRADE.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 UPGRADE.md diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 0000000..36af71b --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,42 @@ +# Upgrading to 4.0.0 + +## Constructors Of `FetchServer` and `Server` Take An Object + +For `Server`: + +```diff +import { Server } from 'fakerest'; +import { data } from './data'; + +-const server = new Server('http://myapi.com'); ++const server = new Server({ baseUrl: 'http://myapi.com' }); +server.init(data); +``` + +For `FetchServer`: + +```diff +import { FetchServer } from 'fakerest'; +import { data } from './data'; + +-const server = new FetchServer('http://myapi.com'); ++const server = new FetchServer({ baseUrl: 'http://myapi.com' }); +server.init(data); +``` + +## Constructor Of `Collection` Take An Object + +```diff +-const posts = new Collection([ +- { id: 1, title: 'baz' }, +- { id: 2, title: 'biz' }, +- { id: 3, title: 'boz' }, +-]); ++const posts = new Collection({ ++ items: [ ++ { id: 1, title: 'baz' }, ++ { id: 2, title: 'biz' }, ++ { id: 3, title: 'boz' }, ++ ], ++}); +``` \ No newline at end of file