Skip to content

Commit 7b0af2d

Browse files
committed
docs: add getting-started guide in readme
1 parent a31b5fc commit 7b0af2d

File tree

3 files changed

+98
-3
lines changed

3 files changed

+98
-3
lines changed

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Fast Backend Framework
66

77
- **🔥 Fully TypeScript support**
88
- **🚀 Automatic server reload**
9-
- **🎯 File based routing**
9+
- **🎯 File-based routing**
1010

1111
## Getting Started
1212

@@ -21,6 +21,50 @@ Available templates:
2121
- TypeScript _(recommended)_
2222
- JavaScript
2323

24+
## Routes
25+
26+
Dobs uses a simple and intuitive file-based routing system.
27+
All route files must be placed inside the `/app/` directory.
28+
Each file automatically becomes a route based on its path.
29+
30+
For example:
31+
32+
```
33+
project/
34+
└─ app/
35+
├─ index.ts → /
36+
├─ user.ts → /user
37+
└─ post/
38+
└─ [id].ts → /post/:id
39+
```
40+
41+
### Example
42+
43+
```ts
44+
import { defineRoutes } from 'dobs';
45+
46+
export default defineRoutes((req, res) => {
47+
res.send('Hello from Dobs!');
48+
});
49+
```
50+
51+
This route responds with `"Hello from Dobs!"` for all HTTP methods.
52+
53+
If you want to handle methods separately:
54+
55+
```ts
56+
import { defineRoutes } from 'dobs';
57+
58+
export default defineRoutes({
59+
GET(req, res) {
60+
res.send({ message: 'This is GET' });
61+
},
62+
POST(req, res) {
63+
res.send({ message: 'This is POST' });
64+
},
65+
});
66+
```
67+
2468
## LICENSE
2569

2670
MIT

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"lint-fix": "eslint --fix --ext .js,.ts .",
3939
"test": "vitest run",
4040
"build": "tsdown",
41-
"run-script": "node -r @swc-node/register"
41+
"run-script": "node -r @swc-node/register",
42+
"publish": "lerna version && yarn build && lerna publish from-package"
4243
},
4344
"version": "0.0.0",
4445
"packageManager": "yarn@4.10.3"

packages/dobs/README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# dobs
22

3-
Lightweight backend framework
3+
Fast Backend Framework
4+
5+
## Features
6+
7+
- **🔥 Fully TypeScript support**
8+
- **🚀 Automatic server reload**
9+
- **🎯 File-based routing**
410

511
## Getting Started
612

@@ -15,6 +21,50 @@ Available templates:
1521
- TypeScript _(recommended)_
1622
- JavaScript
1723

24+
## Routes
25+
26+
Dobs uses a simple and intuitive file-based routing system.
27+
All route files must be placed inside the `/app/` directory.
28+
Each file automatically becomes a route based on its path.
29+
30+
For example:
31+
32+
```
33+
project/
34+
└─ app/
35+
├─ index.ts → /
36+
├─ user.ts → /user
37+
└─ post/
38+
└─ [id].ts → /post/:id
39+
```
40+
41+
### Example
42+
43+
```ts
44+
import { defineRoutes } from 'dobs';
45+
46+
export default defineRoutes((req, res) => {
47+
res.send('Hello from Dobs!');
48+
});
49+
```
50+
51+
This route responds with `"Hello from Dobs!"` for all HTTP methods.
52+
53+
If you want to handle methods separately:
54+
55+
```ts
56+
import { defineRoutes } from 'dobs';
57+
58+
export default defineRoutes({
59+
GET(req, res) {
60+
res.send({ message: 'This is GET' });
61+
},
62+
POST(req, res) {
63+
res.send({ message: 'This is POST' });
64+
},
65+
});
66+
```
67+
1868
## LICENSE
1969

2070
MIT

0 commit comments

Comments
 (0)