Update to support v6.0.0
This commit is contained in:
parent
b5fea5806d
commit
b1bd5c341e
14 changed files with 190 additions and 92 deletions
|
@ -1,10 +1,11 @@
|
||||||
.dart_tool
|
.dart_tool
|
||||||
.idea
|
.idea
|
||||||
.pub
|
|
||||||
.vscode
|
.vscode
|
||||||
|
.metals
|
||||||
|
.git
|
||||||
|
.github
|
||||||
|
.packages
|
||||||
logs/
|
logs/
|
||||||
test/
|
test/
|
||||||
build/
|
build/
|
||||||
.analysis-options
|
pubspec.lock
|
||||||
.packages
|
|
||||||
*.g.dart
|
|
12
AUTHORS.md
12
AUTHORS.md
|
@ -1,12 +0,0 @@
|
||||||
Primary Authors
|
|
||||||
===============
|
|
||||||
|
|
||||||
* __[Thomas Hii](dukefirehawk.apps@gmail.com)__
|
|
||||||
|
|
||||||
Thomas is the current maintainer of the code base. He has refactored and migrated the
|
|
||||||
code base to support NNBD.
|
|
||||||
|
|
||||||
* __[Tobe O](thosakwe@gmail.com)__
|
|
||||||
|
|
||||||
Tobe has written much of the original code prior to NNBD migration. He has moved on and
|
|
||||||
is no longer involved with the project.
|
|
|
@ -2,8 +2,4 @@
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
* Changed to use `angel3` packages
|
* Initial version
|
||||||
* Updated to support NNBD
|
|
||||||
* Updated README
|
|
||||||
* Updated default `postgresql` setup
|
|
||||||
* Updated linter to `package:lints`
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
# Contribution
|
|
||||||
|
|
||||||
Any help from the open-source community is always welcome and needed:
|
|
||||||
|
|
||||||
1. Found an issue?
|
|
||||||
- Please [fill a bug report][tracker] with error message and steps to reproduce it.
|
|
||||||
2. Wish a feature?
|
|
||||||
- Open a feature request with use cases.
|
|
||||||
3. Are you using and liking the project?
|
|
||||||
- Create an article about your use case
|
|
||||||
- Do a post on your likes and dislikes
|
|
||||||
- Make a donation.
|
|
||||||
4. Are you a developer?
|
|
||||||
- Fix a bug and send a [pull request][pull_request]
|
|
||||||
- Implement a new feature
|
|
||||||
- Improve the Unit Tests
|
|
||||||
- Improve the [User Guide][doc] and send a [document pull request][doc_repo]
|
|
||||||
5. Have you already helped in any way?
|
|
||||||
- **Many thanks to the contributors and everybody that uses this project!**
|
|
||||||
|
|
||||||
[tracker]: https://github.com/dukefirehawk/angel/issues
|
|
||||||
[pull_request]: https://github.com/dukefirehawk/angel/pulls
|
|
||||||
[doc]: https://angel3-docs.dukefirehawk.com
|
|
||||||
[doc_repo]: https://github.com/dukefirehawk/angel3-guide/pulls
|
|
24
Dockerfile
24
Dockerfile
|
@ -1,14 +1,24 @@
|
||||||
FROM google/dart:latest
|
FROM dart:latest
|
||||||
|
|
||||||
COPY ./ ./
|
# Copy all the source code
|
||||||
|
COPY ./config /app/config
|
||||||
|
COPY ./lib /app/lib
|
||||||
|
COPY ./bin /app/bin
|
||||||
|
COPY ./views /app/views
|
||||||
|
COPY ./web /app/web
|
||||||
|
COPY ./*.yaml /app/
|
||||||
|
|
||||||
# Install dependencies, pre-build
|
WORKDIR /app
|
||||||
RUN pub get
|
RUN dart pub upgrade
|
||||||
|
|
||||||
# Optionally build generaed sources.
|
# Optionally build generated sources.
|
||||||
# RUN pub run build_runner build
|
# RUN pub run build_runner build
|
||||||
|
|
||||||
# Set environment, start server
|
# Set environment, start server in JIT mode
|
||||||
ENV ANGEL_ENV=production
|
ENV ANGEL_ENV=production
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD dart bin/prod.dart
|
CMD dart ./bin/prod.dart -p 3000 -a 0.0.0.0
|
||||||
|
|
||||||
|
# Use -j flag to set higher number of isolates
|
||||||
|
#CMD dart ./bin/prod.dart -p 3000 -a 0.0.0.0 -j 50
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ This is an ORM starter application for [Angel3 framework](https://angel3-framewo
|
||||||
## Installation & Setup
|
## Installation & Setup
|
||||||
|
|
||||||
1. Download and install [Dart](https://dart.dev/get-dart).
|
1. Download and install [Dart](https://dart.dev/get-dart).
|
||||||
2. Install `postgresql` version 9, 10, 11 or 12. **postgresql 13 is not working as the driver do not support SCRAM**
|
2. Install `postgresql` version 10, 11, 12 and 13
|
||||||
3. Create a new user and database in postgres using `psql` cli. For example:
|
3. Create a new user and database in postgres using `psql` cli. For example:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
@ -46,13 +46,13 @@ This is an ORM starter application for [Angel3 framework](https://angel3-framewo
|
||||||
|
|
||||||
3. Insert a message into DB:
|
3. Insert a message into DB:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
curl -H "Content-Type: application/json" -X POST -d '{"message":"OK_Message" }' "http://localhost:3000/greetings/"
|
curl -H "Content-Type: application/json" -X POST -d '{"message":"OK_Message" }' "http://localhost:3000/greetings/"
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```
|
```bash
|
||||||
curl -X POST -d 'message=OK_Message2' "http://localhost:3000/greetings/"
|
curl -X POST -d 'message=OK_Message2' "http://localhost:3000/greetings/"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ void main() async {
|
||||||
hierarchicalLoggingEnabled = true;
|
hierarchicalLoggingEnabled = true;
|
||||||
|
|
||||||
var hot = HotReloader(() async {
|
var hot = HotReloader(() async {
|
||||||
var logger = Logger.detached('{{angel}}')
|
var logger = Logger.detached('[Angel3]')
|
||||||
..level = Level.ALL
|
..level = Level.ALL
|
||||||
..onRecord.listen(prettyLog);
|
..onRecord.listen(prettyLog);
|
||||||
var app = Angel(logger: logger, reflector: MirrorsReflector());
|
var app = Angel(logger: logger, reflector: MirrorsReflector());
|
||||||
|
@ -24,5 +24,5 @@ void main() async {
|
||||||
|
|
||||||
var server = await hot.startServer('127.0.0.1', 3000);
|
var server = await hot.startServer('127.0.0.1', 3000);
|
||||||
print(
|
print(
|
||||||
'{{angel}} server listening at http://${server.address.address}:${server.port}');
|
'[angel] server listening at http://${server.address.address}:${server.port}');
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,5 @@ import 'package:angel3_production/angel3_production.dart';
|
||||||
//
|
//
|
||||||
// https://gitter.im/angel_dart/discussion
|
// https://gitter.im/angel_dart/discussion
|
||||||
void main(List<String> args) =>
|
void main(List<String> args) =>
|
||||||
Runner('{{angel}}', configureServer, reflector: MirrorsReflector())
|
Runner('[Angel3]', configureServer, reflector: MirrorsReflector())
|
||||||
.run(args);
|
.run(args);
|
||||||
|
|
|
@ -10,3 +10,4 @@ postgres:
|
||||||
password: App1970#
|
password: App1970#
|
||||||
useSSL: false
|
useSSL: false
|
||||||
time_zone: UTC
|
time_zone: UTC
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,18 @@ import 'package:angel3_orm_postgres/angel3_orm_postgres.dart';
|
||||||
import 'package:postgres/postgres.dart';
|
import 'package:postgres/postgres.dart';
|
||||||
|
|
||||||
Future<void> configureServer(Angel app) async {
|
Future<void> configureServer(Angel app) async {
|
||||||
|
try {
|
||||||
var connection = await connectToPostgres(app.configuration);
|
var connection = await connectToPostgres(app.configuration);
|
||||||
await connection.open();
|
await connection.open();
|
||||||
|
|
||||||
var logger = app.environment.isProduction ? null : app.logger;
|
var executor = PostgreSqlExecutor(connection, logger: app.logger);
|
||||||
var executor = PostgreSqlExecutor(connection, logger: logger);
|
|
||||||
|
|
||||||
app
|
app
|
||||||
..container!.registerSingleton<QueryExecutor>(executor)
|
..container.registerSingleton<QueryExecutor>(executor)
|
||||||
..shutdownHooks.add((_) => connection.close());
|
..shutdownHooks.add((_) => connection.close());
|
||||||
|
} catch (e) {
|
||||||
|
app.logger.severe("Failed to connect to PostgreSQL. ORM disabled.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<PostgreSQLConnection> connectToPostgres(Map configuration) async {
|
Future<PostgreSQLConnection> connectToPostgres(Map configuration) async {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:angel3_migration/angel3_migration.dart';
|
import 'package:angel3_migration/angel3_migration.dart';
|
||||||
import 'package:angel3_model/angel3_model.dart';
|
|
||||||
import 'package:angel3_serialize/angel3_serialize.dart';
|
import 'package:angel3_serialize/angel3_serialize.dart';
|
||||||
import 'package:angel3_orm/angel3_orm.dart';
|
import 'package:angel3_orm/angel3_orm.dart';
|
||||||
import 'package:optional/optional.dart';
|
import 'package:optional/optional.dart';
|
||||||
|
|
|
@ -19,7 +19,7 @@ AngelConfigurer configureServer(FileSystem fileSystem) {
|
||||||
app.get('/', (req, res) => res.render('hello'));
|
app.get('/', (req, res) => res.render('hello'));
|
||||||
|
|
||||||
app.get('/greetings', (req, res) {
|
app.get('/greetings', (req, res) {
|
||||||
var executor = req.container!.make<QueryExecutor>()!;
|
var executor = req.container!.make<QueryExecutor>();
|
||||||
var query = GreetingQuery();
|
var query = GreetingQuery();
|
||||||
return query.get(executor);
|
return query.get(executor);
|
||||||
});
|
});
|
||||||
|
@ -30,7 +30,7 @@ AngelConfigurer configureServer(FileSystem fileSystem) {
|
||||||
if (!req.bodyAsMap.containsKey('message')) {
|
if (!req.bodyAsMap.containsKey('message')) {
|
||||||
throw AngelHttpException.badRequest(message: 'Missing "message".');
|
throw AngelHttpException.badRequest(message: 'Missing "message".');
|
||||||
} else {
|
} else {
|
||||||
var executor = req.container!.make<QueryExecutor>()!;
|
var executor = req.container!.make<QueryExecutor>();
|
||||||
var message = req.bodyAsMap['message'].toString();
|
var message = req.bodyAsMap['message'].toString();
|
||||||
var query = GreetingQuery()..values.message = message;
|
var query = GreetingQuery()..values.message = message;
|
||||||
var optional = await query.insert(executor);
|
var optional = await query.insert(executor);
|
||||||
|
@ -40,7 +40,7 @@ AngelConfigurer configureServer(FileSystem fileSystem) {
|
||||||
|
|
||||||
app.get('/greetings/:message', (req, res) {
|
app.get('/greetings/:message', (req, res) {
|
||||||
var message = req.params['message'] as String;
|
var message = req.params['message'] as String;
|
||||||
var executor = req.container!.make<QueryExecutor>()!;
|
var executor = req.container!.make<QueryExecutor>();
|
||||||
var query = GreetingQuery()..where!.message.equals(message);
|
var query = GreetingQuery()..where!.message.equals(message);
|
||||||
return query.get(executor);
|
return query.get(executor);
|
||||||
});
|
});
|
||||||
|
|
164
pubspec.yaml
164
pubspec.yaml
|
@ -3,32 +3,156 @@ version: 1.0.0
|
||||||
description: An ORM starter application for Angel3 framework
|
description: An ORM starter application for Angel3 framework
|
||||||
publish_to: none
|
publish_to: none
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.15.0 <3.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
angel3_auth: ^4.0.0
|
angel3_auth: ^6.0.0
|
||||||
angel3_configuration: ^4.1.0
|
angel3_configuration: ^6.0.0
|
||||||
angel3_framework: ^4.2.0
|
angel3_framework: ^6.0.0
|
||||||
angel3_jael: ^4.2.0
|
angel3_jael: ^6.0.0
|
||||||
angel3_migration: ^4.0.0
|
angel3_migration: ^6.0.0
|
||||||
angel3_orm: ^4.0.0
|
angel3_orm: ^6.0.0
|
||||||
angel3_orm_postgres: ^3.0.0
|
angel3_orm_postgres: ^6.0.0
|
||||||
angel3_serialize: ^4.1.0
|
angel3_serialize: ^6.0.0
|
||||||
angel3_production: ^3.1.0
|
angel3_production: ^6.0.0
|
||||||
angel3_static: ^4.1.0
|
angel3_static: ^6.0.0
|
||||||
angel3_validate: ^4.0.0
|
angel3_validate: ^6.0.0
|
||||||
belatuk_pretty_logging: ^4.0.0
|
belatuk_pretty_logging: ^4.0.0
|
||||||
optional: ^6.0.0
|
optional: ^6.0.0
|
||||||
logging: ^1.0.0
|
logging: ^1.0.0
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
angel3_hot: ^4.2.0
|
angel3_hot: ^6.0.0
|
||||||
angel3_migration_runner: ^4.0.0
|
angel3_migration_runner: ^6.0.0
|
||||||
angel3_orm_generator: ^4.1.0
|
angel3_orm_generator: ^6.0.0
|
||||||
angel3_serialize_generator: ^4.2.0
|
angel3_serialize_generator: ^6.0.0
|
||||||
angel3_test: ^4.0.0
|
angel3_test: ^6.0.0
|
||||||
build_runner: ^2.0.3
|
build_runner: ^2.0.3
|
||||||
io: ^1.0.0
|
io: ^1.0.0
|
||||||
test: ^1.17.5
|
test: ^1.17.5
|
||||||
lints: ^1.0.0
|
lints: ^1.0.0
|
||||||
|
dependency_overrides:
|
||||||
|
angel3_container:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/container/angel_container
|
||||||
|
angel3_framework:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/framework
|
||||||
|
angel3_http_exception:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/http_exception
|
||||||
|
angel3_model:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/model
|
||||||
|
angel3_route:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/route
|
||||||
|
angel3_mock_request:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/mock_request
|
||||||
|
angel3_auth:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/auth
|
||||||
|
angel3_client:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/client
|
||||||
|
angel3_websocket:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/websocket
|
||||||
|
angel3_validate:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/validate
|
||||||
|
angel3_configuration:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/configuration
|
||||||
|
angel3_test:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/test
|
||||||
|
jael3:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/jael/jael
|
||||||
|
angel3_jael:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/jael/angel_jael
|
||||||
|
jael3_preprocessor:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/jael/jael_preprocessor
|
||||||
|
angel3_serialize:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/serialize/angel_serialize
|
||||||
|
angel3_serialize_generator:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/serialize/angel_serialize_generator
|
||||||
|
angel3_hot:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/hot
|
||||||
|
angel3_static:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/static
|
||||||
|
angel3_production:
|
||||||
|
path: ../belatuk/packages/production
|
||||||
|
# git:
|
||||||
|
# url: https://github.com/dukefirehawk/angel.git
|
||||||
|
# ref: release/6.0.0
|
||||||
|
# path: packages/production
|
||||||
|
angel3_orm:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/orm/angel_orm
|
||||||
|
angel3_orm_generator:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/orm/angel_orm_generator
|
||||||
|
angel3_orm_postgres:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/orm/angel_orm_postgres
|
||||||
|
angel3_migration:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/orm/angel_migration
|
||||||
|
angel3_migration_runner:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: release/6.0.0
|
||||||
|
path: packages/orm/angel_migration_runner
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<head>
|
<head>
|
||||||
<title>{{ title ?? 'Angel' }}</title>
|
<title>{{ title ?? 'Angel' }}</title>
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
|
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Lato:100" >
|
||||||
<link rel="stylesheet" href="/css/site.css">
|
<link rel="stylesheet" type="text/css" href="/css/site.css">
|
||||||
<link rel="icon" href="/images/favicon.png">
|
<link rel="icon" href="/images/favicon.png">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in a new issue