Referencing issue:

https://github.com/VeryGoodOpenSource/dart_frog/issues/260

Summary

For the framework users, enable the creation of routes and middlewares with a CLI command. Route creation should result in a new endpoint. Middleware creation should add middleware to existing or non-existing endpoints.

Since Dart Frog takes the file system layout as the basis for the routing schema of a server, these commands should create and manage files and directories under routes.

The route and middleware creation should adhere to dart frog's best practices and avoid producing any warnings or errors.

Route creation

After running a new route command, there should not be any rogue or conflicting routes.

It should also create files with the basic dart frog boilerplate, including parameters of dynamic routes.

Dynamic routes files and directories are created exclusively with the bracket syntax. ([id] not <id>)

Routes should be created only on valid route schemas; if there are any invalid characters; rogue routes; or conflicts, route creation should not succeed.

It should assume that the given route is absolute, even when the leading slash / is omitted.

File system test cases

For the file organization, the new route command:

  1. Basic

When the file system is:

/routes
	- index.dart

Running this:

dart_frog new route "/new_route"

Should change it to: