Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.5.0 alpha #8

Merged
merged 31 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
adad0c9
Created module.dart where it will be possible to configure the dartne…
RicardoRB Jun 28, 2023
dcea925
Init modules and defined provider.dart
RicardoRB Jun 29, 2023
06b47dc
Code formatted
RicardoRB Jun 29, 2023
0445bf2
Moved libraries to their packages
RicardoRB Jul 8, 2023
4f34f2c
- Updated dependencies
RicardoRB Jul 11, 2023
7c624e8
Updated class attributes and generator
RicardoRB Jul 11, 2023
346be0c
Init dependencies topologically into inject register
RicardoRB Jul 12, 2023
3dee84f
Removed builder.dart
RicardoRB Jul 12, 2023
8005738
Removed build.dart
RicardoRB Jul 12, 2023
e88e38f
- Fixed generate main()
RicardoRB Jul 12, 2023
f7060ff
string_utils.dart to string_extension.dart
RicardoRB Jul 12, 2023
2b135a5
Added builder again to generator
RicardoRB Jul 12, 2023
852f058
- Init dependencies before starting the server
RicardoRB Jul 12, 2023
27d68bf
Created provider_metadata.dart
Jul 29, 2023
3ba16c3
Removed name instance creation, it will be available for the next ver…
Aug 8, 2023
6bf836d
Updated pubspec
RicardoRB Oct 12, 2023
a4eb3ae
Fixed generating topological instance register
RicardoRB Oct 15, 2023
efef87f
Fixed generating topological instance register
RicardoRB Oct 15, 2023
114ccfa
Fixed created controllers
RicardoRB Oct 15, 2023
c9128c0
Fixed generating options
RicardoRB Oct 15, 2023
2ddcb31
- Fixed generator to generate the controllers in the register
RicardoRB Oct 15, 2023
b7c98f8
Added build in .gitignore
RicardoRB Oct 15, 2023
2499fc6
Added comments and recursive providers
RicardoRB Oct 17, 2023
34b1e1c
Fixed tests
RicardoRB Oct 17, 2023
cab03a0
Removed unused imports
RicardoRB Oct 17, 2023
d3818e1
Changed 'main' to 'init'
RicardoRB Oct 18, 2023
7038449
Updated docs
RicardoRB Oct 18, 2023
5a0a34a
Forgot to add application_generator.dart 'main' to 'init'
RicardoRB Oct 18, 2023
40fadc0
Added website docs
RicardoRB Oct 18, 2023
5fd8d96
0.5.0-alpha
RicardoRB Oct 18, 2023
472611f
Updated simple example
RicardoRB Oct 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
52 changes: 38 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,54 @@ You can check the documentation at [dartness docs](https://ricardorb.github.io/d
$ dart create -t console your_project_name
```

1. Add dartness into the pubspec.yaml
### 1. Add dartness into the pubspec.yaml

```yaml
dependencies:
dartness_server: ^0.4.5-alpha
dartness_server: ^0.5.0-alpha

dev_dependencies:
build_runner: ^2.2.0
dartness_generator: ^0.1.2-alpha
dartness_generator: ^0.4.6-alpha
```

2. Create the file in "bin/main.dart"

### 2.Create the file in "src/app.dart"

```dart
void main() async {
final app = Dartness(
port: 3000,
);
await app.create();
}
@Application(
module: Module(
metadata: ModuleMetadata(
controllers: [],
providers: [],
exports: [],
imports: [],
),
),
options: DartnessApplicationOptions(
port: int.fromEnvironment(
'port',
defaultValue: 8080,
),
),
)
class App {}
```

### 4.Generate the code

```bash
$ dart run build_runner build
```

### 5.Modify "bin/main.dart"
```dart
void main(List<String> args) async {
await App().init();
}
```

3. Run the server
### 6.Run the server

```bash
$ dart run bin/main.dart
Expand Down Expand Up @@ -99,13 +123,13 @@ Server listening on port 3000
- <del>Middleware</del>
- <del>Interceptor</del>
- Websockets
2. Exceptions
2. <del>Exceptions</del>
- <del>Exception Handler</del>
3. Security
- Roles
- CORS
4. Dependency Injection
- Injectable
4. <del>Dependency Injection</del>
- <del>Injectable</del>
5. Scheduling
- Annotation
6. Database
Expand Down
54 changes: 39 additions & 15 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ the [/examples folder](https://github.com/RicardoRB/dartness/tree/master/example

## Requisites

Install [Dart SDK](https://dart.dev/get-dart) version >=2.17.0
Install [Dart SDK](https://dart.dev/get-dart) version >=3.0.0

```bash
$ dart --version
Expand All @@ -47,30 +47,54 @@ You can check the documentation at [dartness docs](https://ricardorb.github.io/d
$ dart create -t console your_project_name
```

1. Add dartness into the pubspec.yaml
### 1. Add dartness into the pubspec.yaml

```yaml
dependencies:
dartness_server: ^0.4.3-alpha
dartness_server: ^0.5.0-alpha

dev_dependencies:
build_runner: ^2.2.0
dartness_generator: ^0.1.0-alpha
dartness_generator: ^0.4.6-alpha
```

2. Create the file in "bin/main.dart"

### 2.Create the file in "src/app.dart"

```dart
void main() async {
final app = Dartness(
port: 3000,
);
await app.create();
}
@Application(
module: Module(
metadata: ModuleMetadata(
controllers: [],
providers: [],
exports: [],
imports: [],
),
),
options: DartnessApplicationOptions(
port: int.fromEnvironment(
'port',
defaultValue: 8080,
),
),
)
class App {}
```

### 4.Generate the code

```bash
$ dart run build_runner build
```

### 5.Modify "bin/main.dart"
```dart
void main(List<String> args) async {
await App().init();
}
```

3. Run the server
### 6.Run the server

```bash
$ dart run bin/main.dart
Expand Down Expand Up @@ -99,13 +123,13 @@ Server listening on port 3000
- <del>Middleware</del>
- <del>Interceptor</del>
- Websockets
2. Exceptions
2. <del>Exceptions</del>
- <del>Exception Handler</del>
3. Security
- Roles
- CORS
4. Dependency Injection
- Injectable
4. <del>Dependency Injection</del>
- <del>Injectable</del>
5. Scheduling
- Annotation
6. Database
Expand Down
32 changes: 22 additions & 10 deletions docs/exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,26 @@ This new created class accepts an instance of the class from where have been cre
must be used in the `errorHandlers` param. You can see an example in the following code:

```dart
void main() async {
final errorHandlers = [
ExampleDartnessErrorHandler(ExampleErrorHandler()),
];
final app = Dartness(
port: 3000,
errorHandlers: errorHandlers,
);
await app.create();
}

@Application(
module: Module(
metadata: ModuleMetadata(
controllers: [],
providers: [
ProviderMetadata(
classType: MyException,
),
],
exports: [],
imports: [],
),
),
options: DartnessApplicationOptions(
port: int.fromEnvironment(
'port',
defaultValue: 8080,
),
),
)
class App {}
```
66 changes: 45 additions & 21 deletions docs/first_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,32 @@ Please make sure that [Dart SDK](https://dart.dev/get-dart) version >=2.17.0 is
$ dart create -t console your_project_name
```

1. Add dartness into the pubspec.yaml
### 1. Add dartness into the pubspec.yaml

```yaml
dependencies:
dartness_server: ^0.4.3-alpha
dartness_server: ^0.5.0-alpha

dev_dependencies:
build_runner: ^2.2.0
dartness_generator: ^0.1.0-alpha
dartness_generator: ^0.4.6-alpha
```

2. Create the file in "bin/main.dart" or whatever file that runs your application.
### 2. Create the file in "bin/app.dart" or whatever file that you consider that you root application is.

```dart
void main() async {
final app = Dartness(
port: 3000,
);
await app.create();
}
@Application(
options: DartnessApplicationOptions(
port: int.fromEnvironment(
'port',
defaultValue: 8080,
),
),
)
class App {}
```

## Generate the code
### 3. Generate the code

Dartness uses the code generation feature provided by the package `code_builder`, this is the way that dart is able to
use reflection since `dart:mirrors` is unstable and not supported in order to compile your package.
Expand All @@ -57,7 +60,7 @@ $ dart run build_runner build
> * [dart:mirrors](https://api.dart.dev/stable/2.17.6/dart-mirrors/dart-mirrors-library.html)
> * [discontinuing support for dart:mirrors](https://github.com/dart-lang/sdk/issues/44489)

## Adding a controller
### 4. Adding a controller

In order to create a controller, you need to import it and add it to the `Dartness` app. You can do
it in two different ways, either adding it when you create the dartness app by the `controllers` param or after
Expand All @@ -77,15 +80,36 @@ This new created class accepts an instance of the class from where have been cre
must be used in the `controllers` param. You can see an example in the following code:

```dart
void main() async {
final controllers = [
CityDartnessController(CityController(CityService())),
];
final app = Dartness(
port: 3000,
controllers: controllers,
);
await app.create();
@Application(
module: Module(
metadata: ModuleMetadata(
controllers: [
ProviderMetadata(
classType: CityController,
),
],
),
),
options: DartnessApplicationOptions(
port: int.fromEnvironment(
'port',
defaultValue: 8080,
),
),
)
class App {}
```

### 5. Generate the code

```bash
$ dart run build_runner build
```

### 6. Modify "bin/main.dart"
```dart
void main(List<String> args) async {
await App().init();
}
```

Expand Down
27 changes: 13 additions & 14 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
<meta charset="UTF-8">
<title>Document</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
<script>
<div id="app"></div>
<script>
window.$docsify = {
name: 'Dartness',
repo: '',
loadSidebar: true,
name: '',
repo: ''
}
</script>
<!-- Docsify v4 -->
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
</script>
<!-- Docsify v4 -->
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
</body>
</html>
31 changes: 22 additions & 9 deletions docs/interceptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,30 @@ class MyInterceptor implements DartnessInterceptor {

## Applying interceptor

In order to apply your interceptor, you need to add it to the `interpcetors` list in the `DartnessServer` class. This
In order to apply your interceptor, you need to add it to the `interpcetors` list in the `Module` annotation. This
will create a global interceptors and are used across the whole application, for every controller and every route
handler.

```dart
void main() async {
final app = Dartness(
port: 3000,
interceptors: [MyInterceptor()],
);
// As optional, you can also use app.addInterceptor(MyInterceptor());
await app.create();
}
@Application(
module: Module(
metadata: ModuleMetadata(
controllers: [],
providers: [
ProviderMetadata(
classType: MyInterceptor,
),
],
exports: [],
imports: [],
),
),
options: DartnessApplicationOptions(
port: int.fromEnvironment(
'port',
defaultValue: 8080,
),
),
)
class App {}
```
Loading