什么是JAMstack?

2024-03-17 02:50
文章标签 jamstack

本文主要是介绍什么是JAMstack?,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

You surely came across the term JAMstack in the last couple years.

您肯定在最近几年遇到过术语JAMstack

It defines a group of technologies used together to achieve a goal, like LAMP and MEAN if you are familiar with does.

它定义了一组共同​​用于实现目标的技术,例如LAMPMEAN(如果您熟悉的话)。

What does JAMstack mean?

JAMstack是什么意思?

JAM stands for JavaScript, API, Markup.

JAM表示对于j avaScript,A PI, arkup。

It describes a trend in creating Web Applications and Web Sites that have those key characteristics:

它描述了创建具有以下关键特征的Web应用程序和网站的趋势:

  • There is a “dumb” web server (or CDN) sending the HTML needed to run the app, typically generated using a static site generator. The HTML is not generated

    有一个“哑” Web服务器(或CDN )发送运行应用程序所需HTML,通常是使用静态网站生成器生成的。 不会生成HTML

  • The app can load some JavaScript that receives data from an API. Page interactions like navigation can cause getting more data from an API. Authentication is also done through an API.

    该应用程序可以加载一些从API接收数据JavaScript。 页面交互(例如导航)可能导致从API获取更多数据。 身份验证也通过API进行。

This new approach is a new kind way, compared to

与之相比,这种新方法是一种新的方式

  • traditional websites where the content is already provided in the app (like for static sites)

    应用程式已提供内容的传统网站(例如静态网站)
  • CMS-based websites that load the information from a database in the backend

    基于CMS的网站,可从后端数据库中加载信息
  • server-rendered applications using any kind of backend language

    使用任何类型的后端语言的服务器呈现的应用程序

It’s also different than client-side rendered websites (for example built with React) with a server-side rendered part. The JAMstack does not involve server rendering at all.

它也不同于带有服务器端渲染部分的客户端渲染网站(例如,使用React构建)。 JAMstack完全不涉及服务器渲染。

使用JAMstack有什么优势? (What are the advantages of using the JAMstack?)

  • It’s FAST. The HTML is already generated and the web server must just serve it, without involving any kind of backend operation like looking up data from a database or generating the pages HTML for each request. It can be easily served through a CDN (Content Delivery Network).

    它很快。 HTML已经生成,Web服务器必须只提供它,而不涉及任何后端操作,例如从数据库中查找数据或为每个请求生成页面HTML。 可以通过CDN(内容交付网络)轻松进行维护。
  • It’s EFFICIENT. Since there is no backend, there are no bottlenecks (e.g. no database).

    高效。 由于没有后端,因此没有瓶颈(例如,没有数据库)。
  • It’s CHEAPER, since serving the resources through a CDN is way less costly than serving them through a backend server

    是便宜的,因为通过CDN提供资源的成本比通过后端服务器提供资源的成本更低
  • It’s more SECURE, since the backend is exposed only through an API

    由于后端仅通过API公开,因此更加安全

The traditional approach of server-rendering websites application dynamically, like it happens with WordPress, Laravel and Rails, is being superseded in many cases by a lighter approach.

动态地呈现服务器应用程序的传统方法(如WordPress,Laravel和Rails所采用的方法)在许多情况下已被更轻松的方法所取代。

A typical WordPress site can make 30-100 requests to a database for every page load, depending on the amount of plugins installed. Unless heavily cached, you can recognize a WordPress site when it gets popular on Hacker News, Reddit or any other big site because you get a blank page - which means something crashed on the server, as the site cannot support all that traffic. Many times this is a lost opportunity, because when the site is at its peak in popularity, it does not work.

一个典型的WordPress网站可以在每次页面加载时向数据库发出30-100个请求,具体取决于安装的插件数量。 除非缓存严重,否则您可以在WordPress站点在Hacker News,Reddit或任何其他大型站点上受到欢迎时识别出该站点,因为您会得到一个空白页-这意味着服务器上发生了崩溃,因为该站点无法支持所有流量。 很多时候,这是一个失去的机会,因为当该网站达到顶峰时,它就无法工作。

Serving a static HTML page instead of much, much more efficient than that, and dynamic data can still be fetched when needed, using separate API calls once the HTML is loaded.

为静态HTML页面提供服务的效率远不止于此,效率更高,而且在加载HTML之后,仍可以使用单独的API调用在需要时获取动态数据。

有哪些可用于构建JAMstack应用程序的技术? (What are some technologies that can be used to build JAMstack apps?)

  • Gatsby

    盖茨比

  • Next.js

    Next.js

  • Nuxt

    Nuxt

  • Hugo

    雨果

and more.

和更多。

JAMstack可以用来做什么? (What can JAMstack be used for?)

Many apps can fall under the JAMstack umbrella, and the possibilities are endless, ranging from simple blogs to e-commerce websites (for example with Snipcart) to more complex Web Apps.

许多应用程序都可以归入JAMstack的范畴,并且可能性无限大,从简单的博客到电子商务网站(例如,使用Snipcart ),再到更复杂的Web应用程序。

My blog falls under the JAMstack umbrella. All the HTML is generated at deploy time, and there is nothing else going on.

我的博客隶属于JAMstack。 所有HTML都是在部署时生成的,没有任何其他操作。

翻译自: https://flaviocopes.com/jamstack/

这篇关于什么是JAMstack?的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/817584

相关文章

WHAT - Jamstack(JavaScript, APIs, and Markup 与 Serverless 无服务器架构)

目录 一、介绍1. JavaScript2. APIs3. Markup4. Jamstack 的优势5. Jamstack 架构的工作流程 二、常见的 Jamstack 技术栈三、无服务器架构(Serverless)无服务器架构的核心概念1. 函数即服务(FaaS)2. 后端即服务(BaaS) 无服务器架构的优势无服务器架构的挑战无服务器架构的应用场景 一、介绍 Jamsta