Skip to content

Commit 5c59d72

Browse files
authored
docs: add new command reference (#651)
1 parent f838bac commit 5c59d72

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ Create a production build which includes a `DockerFile` so that you can deploy a
6666
dart_frog build
6767
```
6868

69+
### Create New Routes and Middleware 🛣️
70+
71+
To add new routes and middleware to your project, use the `dart_frog new` command.
72+
73+
```sh
74+
# 🛣️ Create a new route "/hello/world"
75+
dart_frog new route "/hello/world"
76+
77+
# 🛣️ Create a new middleware for the route "/hello/world"
78+
dart_frog new middleware "/hello/world"
79+
```
80+
6981
## Goals 🎯
7082

7183
Dart Frog is built on top of [shelf](https://pub.dev/packages/shelf) and [mason](https://pub.dev/packages/mason) and is inspired by many tools including [remix.run](https://remix.run), [next.js](https://nextjs.org), and [express.js](https://expressjs.com).

docs/docs/basics/middleware.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,12 @@ Handler middleware(Handler handler) {
3636
return handler.use(requestLogger());
3737
}
3838
```
39+
40+
## Creating Middleware
41+
42+
To create new middleware on a Dart Frog project, run the following command:
43+
44+
```bash
45+
# Creates routes/hello/_middleware.dart
46+
dart_frog new middleware "/hello"
47+
```

docs/docs/basics/routes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ Response onRequest(RequestContext context) {
1919
}
2020
```
2121

22+
## Creating Routes
23+
24+
Managing routes in Dart Frog is essentially as simple as managing the file structure under `/routes`. To help on the creation of routes, Dart Frog provides a CLI command to generate a new route.
25+
26+
```shell
27+
# will create routes/hello.dart
28+
dart_frog new route "/hello"
29+
```
30+
2231
## Requests 📥
2332

2433
All route handlers have access to information regarding the inbound request. In this section, we'll take a look at various ways in which we can interact with the inbound request.

docs/docs/roadmap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ In the interest of transparency, we want to share high-level details of our road
4242
- [ ] Dart API Client Generation
4343
- [ ] Open API Documentation Generation
4444
- [ ] DartFrog Testing Library (utilities for unit and e2e testing)
45-
- [ ] CLI `new` command to generate new `routes` and `middleware`
45+
- [x] CLI `new` command to generate new `routes` and `middleware`
4646
- [ ] Health Check endpoint for monitoring
4747
- [ ] Logger which can be configured to adhere to standard log formats (https://cloud.google.com/run/docs/logging)
4848
- [x] WebSocket support

0 commit comments

Comments
 (0)