The homepage displays blockchain list data in the form of cards (Web3 Project 1 Practical Combat Part 5)

We are already hereWeb3 Distributed Storage IPFS (Web3 Project 1 Practical Combat Part 4) Introduction to what isIPFS, and how to install it on your local computer. Although the previous article explained how to installIPFS and made corresponding configurations, in the local development stage, the front end cannot always avoid跨域 this remote request. api’s “common problem”.

Obviously, for common problems like 跨域, you only need to type ,搜索引擎 a> scheme. listed a lot of solutions for you and other keywords, after a while, , reactjs 跨域vue跨域nextjs 跨域搜索引擎跨域

So, before writing首页以卡片形式展示数据, we need to configure 跨域 in the project so that it can be saved on IPFS Get the file.

Configure cross-domain

This article has been written for the fifth time. You must be aware that this project is built using create-next-app scaffolding. In other words, the project is next.jsproject, but it is also areactproject.

Open thenext.config.js file in the project root directory. Add the content in the red box in the picture below.

Guess you like

Origin blog.csdn.net/coco2d_x2014/article/details/134621364