Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ytlyy1773/open-api-blog
开源api接口官网项目
https://github.com/ytlyy1773/open-api-blog
api apis development free nest next open-source public simple
Last synced: 3 months ago
JSON representation
开源api接口官网项目
- Host: GitHub
- URL: https://github.com/ytlyy1773/open-api-blog
- Owner: ytlyy1773
- Created: 2024-08-22T17:07:42.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-09-17T11:31:34.000Z (5 months ago)
- Last Synced: 2024-10-29T23:07:53.919Z (3 months ago)
- Topics: api, apis, development, free, nest, next, open-source, public, simple
- Language: TypeScript
- Homepage: https://www.openapijs.com
- Size: 5.25 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 开源接口
提供简单、开源、免费的 api 接口
供广大开发者学习使用
## 技术架构
- 前端使用 [nextjs](https://nextjs.org/) 开发
- 后端使用 [nestjs](https://nestjs.com/) 开发
## 网站链接
- 🚗 [官网](https://www.openapijs.com/)
- 🚗 [国际官网访问](https://openapijs.vercel.app/)
## 源码链接
- 🔰 [github 仓库地址](https://github.com/ytlyy1773/open-api-blog.git)
- 🔰 [gitee 仓库地址](https://gitee.com/ytlyy1773/open-api-blog.git)
## 系统要求
- **Node.js 18.18** 或更高版本。
## 运行
> 国内建议使用 `npm` 淘宝镜像地址下载
```bash
pnpm ipnpm dev
```## 说明
### 多 DevOps 构建问题
- 私有服务器
- vercel
两个不同平台构建出来需要不同 `robots.txt` 和 `sitemap.xml` 文件
自己平台可以控制打包构建的,但是 vercel 就不行了
### 如何解决 vercel 打包和服务器打包不冲突
因为多个域名 public 文件夹下没有 `robots.txt` 和 `sitemap.xml` 文件,需要动态生成
**添加 build:vercel 打包命令**
```json
"scripts": {
"dev": "next dev",
"build": "next build && next-sitemap",
"build:vercel": "next build && next-sitemap && next build",
"start": "next start",
"build:map": "next-sitemap"
},
```- 第一次执行 `next build` 保证 `next-sitemap` 可以正常执行
- 执行 `next-sitemap` 可以根据 vercel 配置的**环境变量域名**动态生成 `robots.txt` 和 `sitemap.xml` 文件
- 第二次执行 `next build`,此时 `next-sitemap` 已经帮我们在 public 文件夹下生成了所需要的 `robots.txt` 和 `sitemap.xml` 文件。构建成功就可以正常访问 `robots.txt` 和 `sitemap.xml` 文件了
## 赞助
![]()
![]()