netlify 部署vue_如何构建和部署无服务器功能以进行Netlify

本文介绍了如何将Vue应用程序与无服务器功能一起构建和部署到Netlify平台,通过引用外部资源详细阐述了具体步骤。
摘要由CSDN通过智能技术生成

netlify 部署vue

介绍 (Introduction)

It is a good software engineering practice to separate portions of your code function to work independently of other parts. Since your codes are made up of functions basically, serverless functions allow you to deploy those functions without the complexity of managing a server to run them.

将代码功能的各个部分分开以独立于其他部分工作是一种很好的软件工程实践。 由于代码基本上由功能组成,因此无服务器功能使您可以部署这些功能,而无需管理服务器来运行它们。

In this tutorial, we will be learning what serverless functions are, how to write them, and how to deploy them on Netlify in minutes. We will also touch up on other uses of serverless functions.

在本教程中,我们将在几分钟内学习什么是无服务器功能,如何编写它们以及如何在Netlify上部署它们。 我们还将探讨无服务器功能的其他用途。

什么是无服务器功能? (What are Serverless Functions?)

A serverless function is a function hosted on a cloud infrastructure and performs a single purpose. It is very similar to every other function you write as long as it has its own dependencies and can run on its own. It is serverless because it takes off the stress of server maintenance and scaling the function from you.

无服务器功能是托管在云基础架构上的功能,可以执行一个目的。 它与您编写的所有其他函数非常相似,只要它具有自己的依赖关系并且可以自己运行即可。 它是无服务器的,因为它减轻了服务器维护和扩展功能的压力。

Netlify has made it very easy to write any backend task and deploy it independently or alongside your project in simple steps. Your functions can also be deployed by a simple git push command if linked with your GitHub repository. These functions are called Netlify Functions.

Netlify使编写任何后端任务并轻松地将其独立部署或与您的项目一起部署变得非常容易。 如果与GitHub存储库链接,还可以通过简单的git push命令部署您的功能。 这些功能称为Netlify功能

Serverless functions work just like your API endpoint

无服务器功能就像您的API终结点一样工作

让我们构建我们的无服务器功能 (Let’s Build our Serverless Function)

创建一个项目文件夹 (Create a project folder)

Create an empty folder either manually or by running mkdir custom-netlify-functions. Use any name you feel like. Here I'm using 'custom-netlify-functions'.

手动或通过运行mkdir custom-netlify-functions创建一个空文件夹。 使用您喜欢的任何名称。 在这里,我正在使用“ custom-netlify-functions”。

使用GitHub设置CI / CD (Setup CI/CD with GitHub)

用GitHub初始化仓库 (Initialize repo with GitHub)

  • Change to the folder cd custom-netlify-functions

    转到文件夹cd custom-netlify-functions

  • Create a readme.md file touch readme.md

    创建一个readme.md文件, touch readme.md

  • Run git init to initialize folder with Git repos

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值