mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 18:36:21 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50453e2af9 | ||
|
|
c25e8b7e4d |
@@ -1,36 +1,83 @@
|
|||||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
# This branch was deprecated.
|
||||||
|
|
||||||
## Getting Started
|
In the initial plan of the blog, `raw.githubusercontent.com/<usr>/<branch>/<path_to_file>` (or any other git server)
|
||||||
|
was used as the cdn for the blog website, which also come with VCS without effort.
|
||||||
|
|
||||||
First, run the development server:
|
The idea is to build a separate repo that will be served as a database in ideal blog system structure, and all the
|
||||||
|
functionality related to CMS will be hosted by cloudflare worker.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run dev
|
master > tree
|
||||||
# or
|
.
|
||||||
yarn dev
|
├── idx.json
|
||||||
# or
|
└── posts
|
||||||
pnpm dev
|
├── another_article.md
|
||||||
# or
|
├── hello_world.md
|
||||||
bun dev
|
└── idx.json
|
||||||
|
|
||||||
|
2 directories, 3 files
|
||||||
```
|
```
|
||||||
|
|
||||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
This is an example of [db repo](https://github.com/Lumither/blog-posts.git).
|
||||||
|
|
||||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
```bash
|
||||||
|
|
||||||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
master > cat idx.json
|
||||||
|
{
|
||||||
|
"idx": [
|
||||||
|
{
|
||||||
|
"type": "dir",
|
||||||
|
"name": "posts"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
master > cat ./posts/idx.json
|
||||||
|
{
|
||||||
|
"idx": [
|
||||||
|
{
|
||||||
|
"type": "md",
|
||||||
|
"name": "another_article.md",
|
||||||
|
"meta": {
|
||||||
|
"title": "another_article!",
|
||||||
|
"desc": "test",
|
||||||
|
"tag": ["blog", "test", "dev"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "md",
|
||||||
|
"name": "hello_world.md",
|
||||||
|
"meta": {
|
||||||
|
"title": "Hello World!",
|
||||||
|
"desc": "test",
|
||||||
|
"tag": ["blog", "test", "dev"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Learn More
|
These are examples of `idx.json`. They were designed to be placed at any layer of the directory, and used
|
||||||
|
to accelerate the client side browsing. The following is an easy [implementation](/app/blog/fetch_posts.ts) of using `idx.json` at `/posts`
|
||||||
|
to get a list of blog posts.
|
||||||
|
|
||||||
To learn more about Next.js, take a look at the following resources:
|
```ts
|
||||||
|
export default async function fetch_posts(url: string): Promise<Result<JSON[], Error>> {
|
||||||
|
const response = await fetch(`${ url }/posts/idx.json`);
|
||||||
|
if (!response.ok) {
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
error: new Error(response.statusText)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const res = await response.json();
|
||||||
|
const posts = res['idx'].filter((posts: { type: string }) => posts.type === 'md');
|
||||||
|
return {
|
||||||
|
ok: true,
|
||||||
|
value: posts
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
The approach work impressively well, thanks for the globe services of GitHub lol, but eventually the plan was changed
|
||||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
due to ethical reasons and possibility of breaking GitHub's EULA. Plus, the functionality of the blog site might be constrained due to
|
||||||
|
Cloudflare worker's CPU time limitations, considering the existence of potential resource-intense work such as on-site searching and analytics.
|
||||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
||||||
|
|
||||||
## Deploy on Vercel
|
|
||||||
|
|
||||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
||||||
|
|
||||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
|
||||||
Reference in new issue
Block a user