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文件。