Skip to content

Commit

Permalink
docs: update content
Browse files Browse the repository at this point in the history
  • Loading branch information
kuizuo committed Oct 3, 2024
1 parent e1ffc47 commit 29a6e30
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
8 changes: 6 additions & 2 deletions blog/develop/Next js 使用 Hono 接管 API.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ description: 这篇文章详细介绍了如何在 Next.js 项目中使用 Hono
image: https://img.kuizuo.cn/2024/1002213046-nextjs-with-hono.png
---

<!-- truncate -->

直入正题,Next.js 自带的 API Routes (现已改名为 [**Route Handlers**](https://nextjs.org/docs/app/building-your-application/routing/route-handlers)) 异常难用,例如当你需要编写一个 RESTful API 时,尤为痛苦,就像这样

![image.png](https://img.kuizuo.cn/2024%2F0930171329-image.png)

<!-- truncate -->


这还没完,当你需要数据验证、错误处理、中间件等等功能,又得花费不小的功夫,所以 Next.js 的 API Route 更多是为你的全栈项目编写一些简易的 API 供外部服务,这也可能是为什么 Next.js 宁可设计 [Server Action](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations) 也不愿为 API Route 提供传统后端的能力。

但不乏有人会想直接使用 Next.js 来编写这些复杂服务,恰好 [Hono.js](https://hono.dev/docs/getting-started/vercel) 便提供相关能力。
Expand Down Expand Up @@ -161,7 +163,9 @@ app.onError(handleError)
+ import { zValidator } from '@/server/api/validator'
```

这样就将错误统一处理,且后续自定义业务错误也同样如此。
这样就将错误统一处理,响应体也自定义,且后续自定义业务错误也同样如此。

![](https://img.kuizuo.cn/2024%2F1003095801-20241003095800.png)

:::note 顺带一提

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ description: 这篇文章分享了作者在一家 AI 公司入职一个月的心
image: https://img.kuizuo.cn/2024/0729092038-ai-people.png
---

已经在一家 AI 公司入职了一个月,记得半年前探讨着[职业规划](/blog/2023-year-end-summary),对坐班有些厌恶的我,没想到有一天也会开始通勤打卡。而经历了这一个月的工作,我对坐班的态度有所转变,开始理解这种工作方式对我的意义。是时候分享入职这期间的工作内容与感受。
import Tweet from '@site/src/components/Tweet';

:::success 前文提醒

作者已于 9 月 30 日离职,本以为能遇到个好的 LD,没想到却是个演子,最后还先行我而去并把我拉黑,将烂摊子丢给我😅。

以下内容只发生于入职后的 1 个月,之后就过着如同牛马般的生活,日子又开始没有盼头了。

如果你对我这 5 个月的职场经历感兴趣,可以关注我的[账号](https://x.com/kuizuo) ,或许之后会对这段工作经历再写一篇感悟。

:::

已经在一家 AI 公司入职了一个月,对坐班有些厌恶的我,没想到有一天也会开始通勤打卡。而经历了这一个月的工作,我对坐班的态度有所转变,开始理解这种工作方式对我的意义。是时候分享入职这期间的工作内容与感受。

<!-- truncate -->

Expand Down
2 changes: 1 addition & 1 deletion src/pages/about.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import social from '@site/data/social'

- <p className="inline-flex gap-1">👨‍💻 全网同名愧怍(Kuizuo),头像[酷乐](https://baike.baidu.com/item/%E9%85%B7%E4%B9%90/18058703) <img src="/img/logo.webp" width="26" heigth="26" className="rounded-full" /></p>

- 🧑 一个刚本科毕业的大学生🐂🐴,现居福州,就职于一家 AI 初创公司。
- 🧑 一个刚本科毕业的大学生🐂🐴,现居福州,就职于一家 AI 初创公司(已于 9 月 30 日离职)

- 🐛 曾写过两年的易语言+爬虫,在此期间接触了[自动化和逆向工程](/blog/2020-year-end-summary/),现在主攻 JS/TS 全栈开发,立志成为一名全栈工程师。

Expand Down

0 comments on commit 29a6e30

Please sign in to comment.