立即查看运行:
- 在github上下载并解压此项目 或 将此项目clone你选择的路径下。
- 在项目的根目录下,执行
npm install下载项目依赖(可打开package.JSON文件查看所需模块)。 - 同样,在项目的根目录下,执行
npm start,如果没有自动打开,请在网址栏输入http://localhost:3000/。
├──CONTRIBUTING.md
├──README.md
├──SEARCH_TERMS.md
├──package.json
├──public
│ ├──favicon.ico
│ └──index.html
└──src
├──App.css
├──App.js
├──App.test.js
├──BooksAPI.js
├──Book.js
├──BookShelf.js
├──HeaderPart.js
├──SearchPage.js
├──icons
│ ├──add.svg
│ ├──arrow-back.svg
│ └──arrow-drop-down.svg
├──index.css
└──index.jsMethod Signature:
getAll()- Returns a Promise which resolves to a JSON object containing a collection of book objects.
- This collection represents the books currently in the bookshelves in your app.
Method Signature:
update(book, shelf)- book:
<Object>containing at minimum anidattribute - shelf:
<String>contains one of ["wantToRead", "currentlyReading", "read"] - Returns a Promise which resolves to a JSON object containing the response data of the POST request
Method Signature:
search(query)- query:
<String> - Returns a Promise which resolves to a JSON object containing a collection of a maximum of 20 book objects.
- These books do not know which shelf they are on. They are raw results only. You'll need to make sure that books have the correct state while on the search page.
BooksAPI使用一组固定的缓存搜索结果,并限于一组特定的搜索项,可在 SEARCH_TERMS.md 中找到。该列表中的选项是唯一适用于后端的选项,因此,如果搜索Basket Weaving或Bubble Wrap之类的选项,并不会返回任何结果。