API和微服务有什么区别? [英] What is the difference between an API and Microservice?
问题描述
我使用Django创建了我的API其余部分,但是我不了解如何将API转换为微服务,也不了解它们之间的真正区别. 我看到了像微服务这样的API,但是我不知道要在微服务中转换整个API,我需要创建微Web服务器吗?
I create my API rest with Django, but I don't understand how convert an API to micro services, I don't understand the real difference between these. I see an API like a micro service, but I don't know convert an entire API in micro service, I need create micro web servers?
请,我无法理解微服务,我需要了解这一点.
Please, I can't understand a micro services, and I need understand this.
推荐答案
微服务通过API公开其接口以及它可以做什么. API是微服务在收到命令/查询时响应的所有端点的列表.微服务包含API 和其他用于响应客户请求的内部+隐藏的东西.
A microservice exposes it's interface, what it can do, by means of an API. The API is the list of all endpoints that a microservice respond when it receives a command/query. The microservice contains the API and other internal+hidden things that it uses to respond to client's requests.
API是客户端在查看微服务时所看到的全部内容,尽管微服务要比API大.微服务隐藏其内部结构,技术堆栈,数据库类型(sql
,nosql
-可以是任何东西);一个微服务可以从sql
移到nosql
,从python
移到php
,但是保持其API不变.
An API is all that the clients see when they look at the microservice, although the microservice is bigger than that. A microservice hides its internal structure, it's technology stack, it's database type (sql
, nosql
- it could be anything); a microservice could move from sql
to nosql
, from python
to php
, but keep it's API unchanged.
这篇关于API和微服务有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!