当前位置:网站首页>5 minutes to quickly launch web applications and APIs (vercel)
5 minutes to quickly launch web applications and APIs (vercel)
2022-06-22 22:24:00 【Lima】
“Last week, a kid asked me how to build one quickly Web application , I want to practice my hand , Do not consider purchasing servers . I recommended the popular one some time ago
Vercel, Next I'll show you 5 Minutes to go !
Vercel
Vercel You can understand it as a deployment tool , Support the deployment of static web pages and Node service , After deployment, you can also access the generated domain name https.

More than that , Except for his own son Nextjs outside , It also provides a lot of template support , for example :
Nuxt.js: Vue Of SSR frame Hexo: Quickly generate blog sites Remix: An edge native full stack JavaScript frame Templates up to 30 Kind of ..

Vercel The core of the system mainly includes development 、 preview 、 Deploy . By authorization Github to Vercel after , You can select the project we want to deploy Github Warehouse , The project automatically updates the deployment . Next, I'll teach you to do it in one step !
1. Select template
“This demonstration practice framework , I choose vercel My son
Next.js. He provided many cases , Here I choose one Template :with-vercel-fetch. To achieve a simple SSR service .

stay Vercel Create a project , You'll find that Vercel Follow Github It can be linked ! Support to help you create a private Github Warehouse , The essence is similar Github Page, however Github Page Your access speed is too slow . this Vercel Directly kill .

stay Vercel After helping us create the warehouse , Yes Demo Make some adjustments in the warehouse

Here I am fetch Of API The interface uses Apifox Provided Cloud Mock The function of , You can adjust the interface data without setting up a set of back-end services !
stay Apifox Of Web Create an interface in version , Then, the interface return fields are Mock Customize ( Support customization Mock data )
This is a cloud I customized Mock Interface https://mock.apifox.cn/m1/388694-0-default/star/list

Interested friends can experience www.apifox.cn
2. Release
After completing the above steps ,vercel The deployment phase will be automatically executed , And generate the access domain name , At the same time, you can see the preview effect of the application !

And later your github Warehouse only main Any changes to the branch ,vercel Can automatically trigger Deploy Deploy .
For a final visit, we use vercel Deployed pages

“Ah Le classmate : Well, if I want to replace the domain name ? Do not use the domain name assigned by him
Tolerable , If you want to bind an independent domain name , You can operate view domain Perform custom domain name binding , Finally, go to the domain name resolution to resolve CNAME To cName.vercel-dns.com

3. Other deployment methods
Vercel Provide deploy Hook, You can vercel Configuration on the control panel in the created project deploy hook, You just need to fill in deploy( Deploy ) The branch of git branch, And the corresponding hook name ( Customize ), You can configure an independent trigger mode . The configuration is as follows

Finally, we initiate the request on the command line , You can trigger the construction and deployment of the project . Is it convenient !
curl -X POST https://api.vercel.com/v1/integrations/deploy/prj_GeziGEUiSxxxxxx/tV4Wm5MO2j
4.Serverless relevant
“Vercel It is essentially a zero configuration Serverless Deployment platform , What is Serverless Well ? You can look at the previous article written by tree jam : You learn BFF and Serverless Did you?

Vercel Realization Serverless The bottom layer is based on AWS( Amazon cloud ) Of lambda This mountain . We use it vercel Can deploy Serverless Interface , Next, we will develop a simple Serverless API
Execute in a local project
1. npm install [email protected] -g ( Global installation )
2. vercel login
3. vercel ( In addition to initialization .vercel file It can also trigger the Deploy Deploy )

After completing the appeal operation , We can start work ! We found that vercel The command will help us create .vercel Folder , Then we create a with the directory api Folder , And create a new one " Cloud functions " message, Let's look at the code structure !

Finally, re execute vercel, You can deploy this Serverless API 了 ! We'll use Apifox debugged ! Successfully returns !

边栏推荐
- Leetcode daily question - 513 Find the value in the lower left corner of the tree
- sitl_ gazebo/include/gazebo_ opticalflow_ plugin. h:43:18: error: ‘TRUE’ was not declared in this scope
- ACM. The beauty of hj45 name ●●
- Based on AI driven macromolecular drug discovery, "Huashen Zhiyao" obtained nearly 500million yuan of round a financing
- Rendu stéréo
- 【象棋人生】01 人生如棋
- Install MySQL for Linux (package succeeded!!)
- TC397 Flash
- Redis core technology and practice: learning summary directory
- Task management of embedded development foundation (thread management)
猜你喜欢

二级造价工程师考前必备15个知识点来了!祝你旗开得胜!

7-9 super Mary

5分钟快速上线Web应用和API(Vercel)

The required reading for candidates | PMP the test on June 25 is approaching. What should we pay attention to?

Redis core technology and practice: learning summary directory

The third training of Hongmeng

Developing salary management system based on C language course paper + source code and executable EXE file

Ten thousand words long text | use RBAC to restrict access to kubernetes resources

General trend wisdom to create inclined model and cut monomer

Home page navigation + left menu of spa project development
随机推荐
RuntimeError: CUDA error: CUBLAS_ STATUS_ EXECUTION_ FAILED when calling `cublasSgemmStridedBatched( ha
RealNetworks vs. Microsoft: the battle in the early streaming media industry
Uniapp applet mall develops thinkphp6 points mall, group purchase and seckill packaged app
322.零钱兑换
Liunx installing MySQL
[icml2022] using virtual nodes to promote graph structure learning
ACM. The beauty of hj45 name ●●
6-6 图的广度遍历-邻接矩阵实现
【ROS 入门学习 】CmakeList.txt 和Packages.xml释义
6月PMP考试准考证问题及注意事项,考生必读
【象棋人生】01 人生如棋
CYCA少儿形体礼仪 深圳市培训成果考核圆满落幕
Lesson 030: file system: introduce a big thing | after class test questions and answers
Developing salary management system based on C language course paper + source code and executable EXE file
Makefile:1860: recipe for target ‘cmake_check_build_system‘ failed make: *** [cmake_check_build_syst
Database summary: common problems and Optimization in MySQL development
[GWCTF 2019]mypassword XSS
Redis core technology and practice: learning summary directory
Implementation of depth traversal adjacency matrix of figure 6-5
【论文解读】关于基于视觉无人机自主降落平台的论文梳理