Microservice Architecture and Practice 3_api

Scenario Analysis

Describe product services, REST-based interface

Representational State Transfer (REST)

 

task split

Divide the overall work to be done into smaller tasks:

  • Focus on one task at a time
  • Do continuous integration for each completed part
  • Overall progress is easy to track

mind Mapping

 

 

Hello World API

Development languageRuby

Ruby framework:

  • Ruby on Rails
  • lightweight framework
    • Sinatra
    • Webmachine
    • Grape

Advantages of web framework _Grape:

  • RESTful
  • Lightweight, able to run on Rack server
  • Documentation friendly, using DSL to simplify API development
  • Introduction to version control, routing management, interface parameter management

API specific implementation

Gems mirror: Specify the mirror source for Ruby Gems

 

 Code testing and static checking

 Code test:

  RSpec as a code testing tool

  Rake is a build tool in the Ruby world

  Test coverage statistics

    SimpleCov is a more convenient tool for statistical code test coverage in the Ruby world. It is very simple to use.

  static check

    Rubocop completes static checking of code

    Static checking integrated with Rake tasks

  code complexity check

    Cane completes code complexity check

     Integration with Rake tasks

 

 

 

 

 

 

 

 

  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324474612&siteId=291194637