Skip to content

An ASP.NET Core Web API that given the name of a Pokemon returns its description in Shakespearean style.

License

Notifications You must be signed in to change notification settings

fabriziobagala/pokemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pokemon

An ASP.NET Core Web API that given the name of a Pokemon returns its description in Shakespearean style.

Prerequisites

On your machine must be installed:

  • Visual Studio 2019 is a full-featured IDE to code, debug, test, and deploy to any platform.
  • .NET Core 3.1.402 is a cross-platform version of .NET for building websites, services, and console apps.
  • Postman 7.32 is a collaboration platform for API development.
  • Node.js 14.11 is a JavaScript runtime built on Chrome's V8 JavaScript engine.
  • Newman 5.2.0 is a command line Collection Runner for Postman.
  • HTTPie 2.2.0 is a user-friendly command-line HTTP client for the API era.

Third-Party Libraries

The solution uses the following Nuget packages:

  • Json.NET is a popular high-performance JSON framework for .NET.
  • Serilog provides diagnostic logging to files, the console, and elsewhere.
  • Moq is the most popular and friendly mocking library for .NET.

Usage

Open the solution with Visual Studio.
Launch the application and wait for the default browser to open with the following URL:

http://localhost:5000/pokemon

If you see "All is OK", the application has started correctly; otherwise, consult the log file inside the Logs folder to check the issue.

Open the terminal and type the following command:

http http://localhost:5000/pokemon/charizard

Example:

HTTPie

API Design

Description

Get Pokemon description in Shakespearean style about a specific Pokemon name.

Request

GET pokemon/{name}

Path parameters

Name Type Required Description Example
name string yes The Pokemon name charizard

Response

Code Description Media type Example
200 Returned when successful application/json { "name": "charizard", "description": "Charizard flies 'round the sky in search of powerful opponents. 't breathes fire of such most wondrous heat yond 't melts aught. However, 't nev'r turns its fiery breath on any opponent weaker than itself." }
404 Returned when resource is not found
503 Returned when the Fun Translations API is unavailable

Automated Testing

Once the application is running, you can launch Postman tests from the command line using Newman.
Move to the directory containing the Postman collection.

cd <repository_path>/src/Postman

Run the following command:

newman run Pokemon_API.postman_collection.json

Example:

Newman

License

Licensed under the MIT license.

About

An ASP.NET Core Web API that given the name of a Pokemon returns its description in Shakespearean style.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages