Appweveor項目已被刪除,因為該項目現在使用Docker,並且所選的Docker圖像是基於Linux的(出於尺寸和速度原因)
如果您發現該項目有用,無論您是您使用的圖書館還是作為學習工具,請考慮給我買咖啡:
要構建和運行Docker映像,請使用以下命令:
docker build . -t dwcheckapidocker run -p 8080:5000 dwcheckapi這將運行Docker映像的最新版本,並在http:// localhost:8080/Swagger上公開應用程序。
該項目是一個.NET核心實現的Web API,用於列出所有(佳能)迪斯世界小說。
它使用實體框架核心與SQLite數據庫進行通信,該數據庫包含每個Discworld小說的記錄。
它已經使用MIT許可證發布了。有關MIT許可證的更多信息,請參閱存儲庫根目錄中的LICENSE文件,或者查看MIT的TL; DR Legal頁面
Dwcheckapi具有行為準則,所有貢獻者,維護者和叉子都必須遵守。當貢獻,維護,分叉或以任何其他方式更改此存儲庫中提出的代碼時,所有用戶都必須同意本行為守則。
有關詳細信息,請參見Code of Conduct.md 。
歡迎拉動請求,但請花點時間閱讀行為守則,或者在提交該庫中的任何工作之前發表評論。
這將需要在第一次運行應用程序之前進行挖掘
更改為持久目錄(即dwCheckApi/dwCheckApi.Persistence )
cd dwCheckApi.Persistence
發出實體框架命令以更新數據庫
dotnet ef database update
這將確保所有遷移都用於創建或更改本地數據庫實例,並準備播種(請參閱Seeding the Database )
更改為API目錄(即dwCheckApi/dwCheckApi )
cd dwCheckApi
發出dotnet reterore命令(這可以解決所有Nuget軟件包)
dotnet restore
發出dotnet build命令
dotnet build
發出dotnet run命令
dotnet run
這將啟動Kestrel Web服務器,加載dwCheckApi應用程序,然後通過終端告訴您訪問dwCheckApi URL。通常,這將是http://localhost:5000 ,但根據您的系統配置可能會有所不同。
有一系列與清除和播種數據庫有關的API端點。這些可以找到:
/Database/DropData
/Database/SeedData
這兩個命令(相互結合使用)將從數據庫中刪除所有數據,然後從一系列可以在SeedData目錄中找到的JSON文件中(分別為數據庫)播種數據庫。
dwCheckApi已設計,以便用戶可以通過JSON文件添加盡可能多的數據。這意味著dwCheckApi不僅限於Discworld小說和角色。
該API的用戶可以更改JSON文件,刪除數據並播放並具有完全不同的數據集 - 例如,Stephen King小說。
該存儲庫包含Xunit.net測試庫。進行測試:
將目錄更改為測試目錄
cd dwCheckApi.Tests
發出dotnet reterore命令(這可以解決所有Nuget軟件包)
dotnet restore
發出xunit命令
dotnet xunit
所有測試都將針對dwCheckApi的新構建,並將在Open Shell/命令提示室窗口中返回結果。
dwCheckApi具有以下控制器:
圖書
Books控制器有兩種方法:
得到
Get動作採用整數ID。該領域代表小說的序數。該序列基於發布訂單,因此,如果用戶需要在“夜間觀察”上進行數據,他們會將get請求設置為:
/Books/Get/29
這將返回以下JSON數據:
{
"bookOrdinal":29,
"bookName":"Night Watch",
"bookIsbn10":"0552148997",
"bookIsbn13":"9780552148993",
"bookDescription":"This morning, Commander Vimes of the City Watch had it all. He was a Duke. He was rich. He was respected. He had a titanium cigar case. He was about to become a father. This morning he thought longingly about the good old days. Tonight, he's in them.",
"bookCoverImage":null,
"bookCoverImageUrl":"http://wiki.lspace.org/mediawiki/images/4/4f/Cover_Night_Watch.jpg",
"characters" :
[
"Fred Colon",
"Nobby Nobbs",
"Rosie Palm",
"Samuel Vimes",
"The Patrician"
]
}
搜尋
Search操作採用一個稱為searchString串的字符串參數。 dwCheckApi將搜索所有書籍記錄的以下字段,並返回一次有任何匹配的字段:
如果用戶希望搜索PRASE“ Rincewind”,則應發出以下請求:
/Books/Search?searchString=Rincewind
這將返回以下JSON數據:
[
{
"bookId":23,
"bookOrdinal":2,
"bookName":"The Light Fantastic",
"bookIsbn10":"0861402030",
"bookIsbn13":"9780747530794",
"bookDescription":"As it moves towards a seemingly inevitable collision with a malevolent red star, the Discworld has only one possible saviour. Unfortunately, this happens to be the singularly inept and cowardly wizard called Rincewind, who was last seen falling off the edge of the world ....",
"bookCoverImage":null,
"bookCoverImageUrl":"http://wiki.lspace.org/mediawiki/images/f/f1/Cover_The_Light_Fantastic.jpg",
"characters":
[
"The Lady",
"Rincewind",
"The Partician",
"The Luggage",
"Blind Io",
"Fate",
"Death",
"Twoflower",
"Offler",
"Ridcully"
]
},
{
"bookId":30,
"bookOrdinal":9,
"bookName":"Eric",
"bookIsbn10":"0575046368",
"bookIsbn13":"9780575046368",
"bookDescription":"Eric is the Discworld's only demonology hacker. Pity he's not very good at it. All he wants is three wishes granted. Nothing fancy - to be immortal, rule the world, have the most beautiful woman in the world fall madly in love with him, the usual stuff. But instead of a tractable demon, he calls up Rincewind, probably the most incompetent wizard in the universe, and the extremely intractable and hostile form of travel accessory known as the Luggage. With them on his side, Eric's in for a ride through space and time that is bound to make him wish (quite fervently) again - this time that he'd never been born.",
"bookCoverImage":null,
"bookCoverImageUrl":"http://wiki.lspace.org/mediawiki/images/2/27/Cover_Eric_%28alt%29.jpg",
"characters" : []
},
{
"bookId":38,
"bookOrdinal":17,
"bookName":"Interesting Times",
"bookIsbn10":"0552142352",
"bookIsbn13":"9780552142359",
"bookDescription":"Mighty Battles! Revolution! Death! War! (and his sons Terror and Panic, and daughter Clancy). The oldest and most inscrutable empire on the Discworld is in turmoil, brought about by the revolutionary treatise What I Did On My Holidays. Workers are uniting, with nothing to lose but their water buffaloes. Warlords are struggling for power. War (and Clancy) are spreading through the ancient cities. And all that stands in the way of terrible doom for everyone is: Rincewind the Wizzard, who can't even spell the word 'wizard' ... Cohen the barbarian hero, five foot tall in his surgical sandals, who has had a lifetime's experience of not dying ...and a very special butterfly.",
"bookCoverImage":null,
"bookCoverImageUrl":"http://wiki.lspace.org/mediawiki/images/9/96/Cover_Interesting_Times.jpg",
"characters" : []
}
]
人物
Characters控制器有兩種方法:
Get動作採用整數ID。該字段表示數據庫中字符條目的ID。不建議該API的消費者使用此控制器方法,因為ID條目完全依賴於實體框架核心在創建數據集時堅持數據庫條目的順序,這是無法預測的。此處包含在此處以進行完整,並且可能會在以後的版本中刪除。
該序列基於發布訂單,因此,如果用戶需要在“夜間觀察”上進行數據,他們會將get請求設置為:
/Characters/Get/4
這將返回與此類似的JSON數據(有關特定字符實體在新創建的數據庫中運行時可能不相同的原因,請參見上文):
{
"characterName":"The Luggage",
"books":
[
"The Colour of Magic"
]
}
Search操作採用一個稱為searchString串的字符串參數。 dwCheckApi將搜索所有字符記錄的名稱,並返回匹配的名稱。
如果用戶希望搜索PRASE“ RI”,則應發出以下請求:
/Characters/Search?searchString=ri
這將返回以下JSON數據:
[
{
"characterName":"Ridcully",
"books":
[
"The Colour of Magic"
]
},
{
"characterName":"Rincewind",
"books":
[
"The Colour of Magic"
]
}
]
L空間Wiki目前正在用於播種數據庫。
所有角色和書籍數據均具有特里·普拉切特(Terry Pratchett)和/或Transworld Publishers的版權保護,沒有打算侵權。
在Seeddata目錄中,有一系列JSON文件。這些文件的數據源是L空間Wiki(上述)和Y自己對Discworld系列的了解的組合。
在將其轉換為JSON文件時,我尚未以L-Space Wiki的任何方式更改任何數據。因此,L-Space Wiki許可證(這是一個創意共享歸因3.0許可證)仍然適用。
有關L-Space Wiki使用的許可證的更多信息,請參閱Data License.md文件。