https://github.com/pyrestudios/steward
A flexible server-side web framework for Dart.
https://github.com/pyrestudios/steward
api-framework dart hacktoberfest mvc-framework router web-framework
Last synced: 7 months ago
JSON representation
A flexible server-side web framework for Dart.
- Host: GitHub
- URL: https://github.com/pyrestudios/steward
- Owner: PyreStudios
- License: mit
- Created: 2021-03-08T03:04:40.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-10-23T02:23:53.000Z (about 2 years ago)
- Last Synced: 2025-03-30T07:18:32.157Z (10 months ago)
- Topics: api-framework, dart, hacktoberfest, mvc-framework, router, web-framework
- Language: Dart
- Homepage:
- Size: 6.18 MB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
A helpful framework for building server-side experiences with Dart.
-----------
[](https://pub.dev/packages/steward)
[](https://codecov.io/gh/PyreStudios/steward)
[](https://pub.dev/packages/steward)
[](https://img.shields.io/github/stars/pyrestudios/steward)
[](https://img.shields.io/github/checks-status/pyrestudios/steward/main?label=main%20build)
[](https://pyrestudios.github.io/steward)
Steward features a command line interface for starting a new Steward project! Check it out!
```
dart pub global activate steward
```
**Note: Steward uses a config yml file that is generated by the CLI. If you choose to not use the CLI, you'll need to generate a matching config.yml file.**
The best examples for how to use Steward are captured in the test folder. Eventually, we'll refactor this out into tests and examples separately, but for now, they live together :)
Using the Steward framework gives you the following (but not limited to) benefits:
- A modular system with light Dependency Injection, Routing, and more.
- Easy HTTP request/response management.
- Config parsing into the DI container at application boot.
- Templating via the Mustache template specification.
Here's an example of how you can use Steward!
```dart
import 'package:steward/steward.dart';
Future main() async {
final router = Router();
final container = Container();
// Setup a DI binding for UserService
container.bind('UserService', (_) => UserService());
// Replace the default DI container implementation
router.setContainer(container);
// Bare route handler example
router.get('/hello', (_) {
return Response.Ok('Hello World!');
});
// Plucking things out of the container example
router.get('/config', (Context context) {
print(context.make('@config.app.name'));
return Response.Ok(context.make('@config.app.name'));
});
// Path Params example
router.get('/:name', (Context context) {
return Response.Ok(context.request.pathParams['name']);
});
var app = App(router: router);
return app.start();
}
```