Merge pull request #4 from dukefirehawk/v6/angel3-graphql

V6/angel3 graphql
This commit is contained in:
Thomas Hii 2022-04-26 09:16:41 +08:00 committed by GitHub
commit 71e10b57d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 30 deletions

View file

@ -1,14 +1,23 @@
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

View file

@ -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}'); '[Angel3] server listening at http://${server.address.address}:${server.port}');
} }

View file

@ -17,7 +17,7 @@ import 'package:angel3_production/angel3_production.dart';
// so use it if possible. // so use it if possible.
// //
// However, the following alternatives exist: // However, the following alternatives exist:
// * Generation via `package:angel_container_generator` // * Generation via `package:angel3_container_generator`
// * Creating an instance of `StaticReflector` // * Creating an instance of `StaticReflector`
// * Manually implementing the `Reflector` interface (cumbersome; not recommended) // * Manually implementing the `Reflector` interface (cumbersome; not recommended)
// //
@ -26,5 +26,4 @@ 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);

View file

@ -8,8 +8,8 @@ MapService? _getTodoService(Angel app) {
const key = 'todoService'; const key = 'todoService';
// If there is already an existing singleton, return it. // If there is already an existing singleton, return it.
if (app.container!.hasNamed(key)) { if (app.container.hasNamed(key)) {
return app.container!.findByName<MapService>(key); return app.container.findByName<MapService>(key);
} }
// Create an in-memory service. We will use this // Create an in-memory service. We will use this
@ -18,7 +18,7 @@ MapService? _getTodoService(Angel app) {
// Register this service as a named singleton in the app container, // Register this service as a named singleton in the app container,
// so that we do not inadvertently create another instance. // so that we do not inadvertently create another instance.
app.container!.registerNamedSingleton(key, mapService); app.container.registerNamedSingleton(key, mapService);
return mapService; return mapService;
} }

View file

@ -2,23 +2,23 @@ name: angel
description: A graphql starter application for Angel3 framework description: A graphql starter application for Angel3 framework
publish_to: none publish_to: none
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.16.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_graphql: ^2.0.0 angel3_graphql: ^6.0.0
angel3_jael: ^4.2.0 angel3_jael: ^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
dev_dependencies: dev_dependencies:
angel3_hot: ^4.2.0 angel3_hot: ^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
graphql_generator2: ^2.1.0 graphql_generator2: ^4.0.0
belatuk_pretty_logging: ^4.0.0 belatuk_pretty_logging: ^4.0.0
build_runner: ^2.0.4 build_runner: ^2.0.4
io: ^1.0.0 io: ^1.0.0
test: ^1.17.5 test: ^1.21.0
lints: ^1.0.0 lints: ^1.0.0