API 和微服务有什么区别? [英] What is the difference between an API and Microservice?

查看:37
本文介绍了API 和微服务有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 Django 创建了我的 API rest,但我不明白如何将 API 转换为微服务,我不明白它们之间的真正区别.我看到一个像微服务一样的 API,但我不知道在微服务中转换整个 API,我需要创建微 Web 服务器吗?

拜托,我无法理解微服务,我需要理解这一点.

解决方案

微服务通过 API 公开它的接口,它可以做什么.API 是微服务在收到命令/查询时响应的所有端点的列表.微服务包含 API 其他用于响应客户端请求的内部+隐藏的东西.

API 就是客户端在查看微服务时看到的全部内容,尽管微服务比它大.微服务隐藏其内部结构、技术栈、数据库类型(sqlnosql - 它可以是任何东西);微服务可以从 sql 移动到 nosql,从 python 移动到 php,但保持它的 API 不变.>

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.

解决方案

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.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆