이 프로젝트가 Docker를 사용하고 선택한 Docker 이미지는 Linux 기반 (크기 및 속도 이유)이므로 Appveyor 프로젝트가 제거되었습니다.
이 프로젝트가 귀하가 사용하는 라이브러리 또는 학습 도구로 도움이된다면 커피를 구입하는 것을 고려하십시오.
Docker 이미지를 빌드하고 실행하려면 다음 명령을 사용하십시오.
docker build . -t dwcheckapidocker run -p 8080:5000 dwcheckapi이것은 Docker 이미지의 최신 빌드를 실행하고 http : // localhost : 8080/swagger에서 응용 프로그램을 노출시킵니다.
이 프로젝트는 모든 (Canon) Discworld 소설을 나열하기위한 .NET Core 구현 웹 API입니다.
Entity Framework Core를 사용하여 각 Discworld 소설에 대한 레코드가 포함 된 SQLite 데이터베이스와 통신합니다.
MIT 라이센스를 사용하여 출시되었습니다. MIT 라이센스에 대한 자세한 내용은 저장소 루트의 LICENSE 파일을 참조하거나 TL; MIT의 DR 법률 페이지를 참조하십시오.
Dwcheckapi에는 모든 기고자, 관리자 및 포커를 준수 해야하는 행동 강령이 있습니다. 이 저장소에 제시된 코드를 기고, 유지, 포킹 또는 다른 방식으로 변경할 때 모든 사용자는이 행동 강령에 동의해야합니다.
자세한 내용은 Code of Conduct.md 참조하십시오.
풀 요청은 환영하지만, 제출 하거나이 리포지어의 작업에 대해 댓글을 달기 전에 행동 강령을 읽으십시오.
처음으로 응용 프로그램을 실행하기 전에 창설해야합니다.
Persistence Directory로 변경 (예 : dwCheckApi/dwCheckApi.Persistence )
cd dwCheckApi.Persistence
엔티티 프레임 워크 명령을 발행하여 데이터베이스를 업데이트하십시오
dotnet ef database update
이렇게하면 모든 마이그레이션이 로컬 데이터베이스 인스턴스를 생성하거나 변경하는 데 사용됩니다 ( Seeding the Database 참조)
API 디렉토리로 변경 (IE dwCheckApi/dwCheckApi )
cd dwCheckApi
dotnet Restore 명령을 발행합니다 (이것은 모든 Nuget 패키지를 해결합니다)
dotnet restore
dotnet 빌드 명령을 발행하십시오
dotnet build
dotnet Run 명령을 발행하십시오
dotnet run
이것은 Kestrel 웹 서버를 시작하고 dwCheckApi 응용 프로그램을로드하고 터미널을 통해 dwCheckApi 에 액세스 할 URL이 무엇인지 알려줍니다. 일반적으로 이것은 http://localhost:5000 이지만 시스템 구성에 따라 다를 수 있습니다.
데이터베이스를 지우고 시드하는 것과 관련된 일련의 API 엔드 포인트가 있습니다. 이들은 다음에서 찾을 수 있습니다.
/Database/DropData
/Database/SeedData
이 두 명령 (서로 함께 사용)은 데이터베이스에서 모든 데이터를 삭제 한 다음 SeedData 디렉토리에서 찾을 수있는 일련의 JSON 파일에서 데이터베이스 (각각)를 시드합니다.
dwCheckApi 사용자가 JSON 파일을 통해 원하는만큼의 데이터를 추가 할 수 있도록 설계되었습니다. 이것은 dwCheckApi Discworld 소설과 캐릭터에만 국한되지 않음을 의미합니다.
이 API의 사용자는 JSON 파일을 변경하고 데이터를 삭제하고 RESEED를 변경하고 완전히 다른 데이터 세트 (예를 들어 Stephen King Novels)를 가질 수 있습니다.
이 저장소에는 xunit.net 테스트 라이브러리가 포함되어 있습니다. 테스트를 실행하려면 :
디렉토리를 테스트 디렉토리로 변경하십시오
cd dwCheckApi.Tests
dotnet Restore 명령을 발행합니다 (이것은 모든 Nuget 패키지를 해결합니다)
dotnet restore
xunit 명령을 발행하십시오
dotnet xunit
모든 테스트는 새로운 dwCheckApi 의 새로운 빌드에 대해 실행되며 결과는 Open Shell/Command 프롬프트 창에서 반환됩니다.
dwCheckApi 에는 다음과 같은 컨트롤러가 있습니다.
서적
Books 컨트롤러에는 두 가지 방법이 있습니다.
얻다
Get Action은 정수 ID를 취합니다. 이 분야는 소설의 서수를 나타냅니다. 이 서수는 릴리스 순서를 기준으로하므로 사용자가 '야간 Watch'에 대한 데이터를 원하는 경우 다음에 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 Action은 정수 ID를 취합니다. 이 필드는 데이터베이스의 문자 항목의 ID를 나타냅니다. ID 항목은 엔티티 프레임 워크 코어가 데이터 세트를 작성하는 동안 데이터베이스의 항목을 지속하는 순서에 전적으로 의존하기 때문에이 API의 소비자는이 컨트롤러 메소드를 사용하는 것이 좋습니다. 이는 예측할 수 없습니다. 여기에는 완전성을 위해 포함되어 있으며 아마도 이후 버전에서 제거 될 것입니다.
이 서수는 릴리스 순서를 기준으로하므로 사용자가 '야간 Watch'에 대한 데이터를 원하는 경우 다음에 GET 요청을 설정합니다.
/Characters/Get/4
이것은 JSON 데이터와 유사한 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- 공간 위키는 현재 데이터베이스를 시드하는 데 사용되고 있습니다.
모든 캐릭터 및 서적 데이터는 Terry Pratchett 및/또는 Transworld Publisher에게 저작권을 갖습니다.
SeedData 디렉토리에는 JSON 파일 모음이 있습니다. 이 파일의 데이터 소스는 L- 공간 위키 (위에서 언급)와 Discworld 시리즈에 대한 지식의 조합입니다.
JSON 파일로 변환 할 때 L- 공간 위키의 데이터를 어떠한 방식 으로든 변경하지 않았습니다. 따라서 L-Space Wiki 라이센스 (Creative Commons Attribution Sharealike 3.0 라이센스)는 여전히 적용됩니다.
L-Space Wiki에서 사용한 라이센스에 대한 자세한 내용은 Data License.md 파일을 참조하십시오.