This is a Next.js project bootstrapped with create-next-app
.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying pages/index.js
. The page auto-updates as you edit the file.
API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js
.
The pages/api
directory is mapped to /api/*
. Files in this directory are treated as API routes instead of React pages.
This project uses next/font
to automatically optimize and load Inter, a custom Google Font.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.
- API 檔案: pages/api/uplaod
- 測試用表單 /upload
- 用了 multer 做為處理檔案上傳用
- 與 next-connect 做為處理在 next 中的 API 的 router 使用
- 安裝在 React 中使用 CKeditor 的核心 @ckeditor/ckeditor5-react
- 安裝預設配置好的 CKeditor 設定 @ckeditor/ckeditor5-build-classic
- 建立 CKeditor 元件,components/Myeditor
- 建立使用 Myeditor 的頁面,/editor
- 參考說明頁面
- 修改成 editor 可以使用的 API: /api/upload2
- API 的 JSON 回應,一定要有 url 這項,editor 才能正確的接應與使用
- editor 元件中建立上傳的處理器 MyUploadAdapter,並設成 CKeditor 的 plugin
- 處理器當中用 fetch 去 call /api/upload2
- 使用 lowdb,資料放在 /data/db.json
- .get /api/article 會抓取路由參數 id,將單一文章內容回傳
- .get /api/aritcles 會抓取所有文章內容回傳
- 文章呈現相關組件在 /pages/article 中
- 只要將 api 中的內容改成讀取不同的資料庫,就可以切換資料庫的使用
- 看完要記得按星星給回饋一下啊⋯⋯