Compare commits

..

27 commits

Author SHA1 Message Date
Thomas Hii
d6a81afab5
Merge pull request #7 from dukefirehawk/angel3-basic
Updated Dockfile
2022-04-26 09:23:58 +08:00
thomashii
fd4abfaf43 Updated Dockfile 2022-04-26 09:22:32 +08:00
Thomas Hii
d171e49fc2
Merge pull request #6 from dukefirehawk/angel3-basic
Angel3 basic
2022-04-26 09:18:34 +08:00
Thomas Hii
debada01f2
Merge pull request #3 from dukefirehawk/v6/angel3-basic
Updated to dart SDK 2.16.0
2022-04-26 09:15:57 +08:00
thomashii
4bdddcdfed Updated to dart SDK 2.16.0 2022-04-26 08:20:54 +08:00
thomashii
023d239c1f Merge branch 'angel3-basic' 2021-09-25 18:46:55 +08:00
thomashii
6867696218 Updated basic template 2021-09-25 18:32:05 +08:00
thomashii
f46ec8058d Updated packages 2021-08-19 08:35:00 +08:00
thomashii
597ea5323a Updated packages 2021-08-19 08:22:49 +08:00
thomashii
8a6bd74bf2 Merge branch 'angel3-basic' 2021-07-17 13:08:15 +08:00
thomashii
2f8dd31c6a Update reference 2021-07-17 13:07:46 +08:00
thomashii
dfd864f0b7 Updated README 2021-07-17 11:48:20 +08:00
thomashii
9e66a1af47 Merge branch 'angel3-basic' 2021-07-17 11:47:40 +08:00
thomashii
be518fa3c0 Updated basic 2021-07-17 11:44:51 +08:00
thomashii
197e4c95e5 Updated README 2021-06-14 09:44:53 +08:00
thomashii
89dde22a52 Updated angel3-basic 2021-06-14 08:02:15 +08:00
thomashii
539696222d Updated README 2021-06-11 12:24:54 +08:00
thomashii
c19f92ba35 Updated templates 2021-06-11 12:22:21 +08:00
thomashii
d74bde03e2 Updated CHANGELOG 2021-06-11 10:36:19 +08:00
thomashii
e986fca7bb Updated template 2021-05-16 18:37:27 +08:00
thomashii@dukefirehawk.com
41d83a274b Migrated to NNBD 2021-05-01 12:07:15 +08:00
thomashii
528dca2db9 Fixed to work with sdk 2.12.x 2021-03-09 00:19:53 +08:00
thomashii
93cdb671d5 Fixed to work with sdk 2.12.x 2021-03-08 21:38:13 +08:00
thomashii
ff8b0e60a8 Updated dependencies 2021-03-07 21:34:59 +08:00
thomashii
00b14878a8 Update bin 2021-03-07 20:45:40 +08:00
thomashii
4f1913d517 Basic templat for SDK 2.12.x 2021-03-07 20:42:48 +08:00
thomashii
a8dc7ef515 Update dependencies for development 2021-02-18 21:30:50 +08:00
20 changed files with 97 additions and 333 deletions

3
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,3 @@
# These are supported funding model platforms
github: [thosakwe]

28
.gitignore vendored
View file

@ -11,6 +11,7 @@
.project .project
.pub/ .pub/
.scripts-bin/ .scripts-bin/
.metals/
build/ build/
**/packages/ **/packages/
@ -37,7 +38,27 @@ pubspec.lock
# User-specific stuff: # User-specific stuff:
.idea/workspace.xml .idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
# Gradle:
.idea/gradle.xml
.idea/libraries
# Mongo Explorer plugin:
.idea/mongoSettings.xml
.vscode/
## File-based project format: ## File-based project format:
*.iws *.iws
@ -60,8 +81,11 @@ crashlytics-build.properties
fabric.properties fabric.properties
### VSCode template ### VSCode template
.vscode/ .vscode/*
.metals/ !.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
logs/ logs/
*.pem *.pem

12
AUTHORS.md Normal file
View file

@ -0,0 +1,12 @@
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.

25
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,25 @@
# 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

View file

@ -1,6 +1,7 @@
# Graphql Starter Application for Angel3 framework
This is a graphql starter application for [Angel3 framework](https://angel3-framework.web.app) which is a full-stack Web framework in Dart. # Basic Starter Application for Angel3 framework
This is a basic starter application for [Angel3 framework](https://angel3-framework.web.app) which is a full-stack Web framework in Dart.
## Installation & Setup ## Installation & Setup
@ -31,5 +32,3 @@ This is a graphql starter application for [Angel3 framework](https://angel3-fram
Visit the [Developer Guide](https://angel3-docs.dukefirehawk.com/guides) for dozens of guides and resources, including video tutorials, to get up and running as quickly as possible with Angel3. Visit the [Developer Guide](https://angel3-docs.dukefirehawk.com/guides) for dozens of guides and resources, including video tutorials, to get up and running as quickly as possible with Angel3.
Examples and complete projects can be found [here](https://angel3-framework.web.app/#/examples). Examples and complete projects can be found [here](https://angel3-framework.web.app/#/examples).
You can also view the [API Documentation](https://pub.dev/documentation/angel3_framework/latest/).

View file

@ -1,10 +1,10 @@
import 'dart:io'; import 'dart:io';
import 'package:logging/logging.dart';
import 'package:belatuk_pretty_logging/belatuk_pretty_logging.dart'; import 'package:belatuk_pretty_logging/belatuk_pretty_logging.dart';
import 'package:angel/angel.dart';
import 'package:angel3_container/mirrors.dart'; import 'package:angel3_container/mirrors.dart';
import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_hot/angel3_hot.dart'; import 'package:angel3_hot/angel3_hot.dart';
import 'package:logging/logging.dart'; import 'package:angel/angel.dart';
void main() async { void main() async {
// Watch the config/ and web/ directories for changes, and hot-reload the server. // Watch the config/ and web/ directories for changes, and hot-reload the server.

View file

@ -1,6 +1,6 @@
import 'package:angel/angel.dart';
import 'package:angel3_container/mirrors.dart'; import 'package:angel3_container/mirrors.dart';
import 'package:angel3_production/angel3_production.dart'; import 'package:angel3_production/angel3_production.dart';
import 'package:angel/angel.dart';
// NOTE: By default, the Runner class does not use the `MirrorsReflector`, or any // NOTE: By default, the Runner class does not use the `MirrorsReflector`, or any
// reflector, by default. // reflector, by default.

View file

@ -1,3 +1,4 @@
/// Configuration for this Angel instance.
import 'package:angel3_configuration/angel3_configuration.dart'; import 'package:angel3_configuration/angel3_configuration.dart';
import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_jael/angel3_jael.dart'; import 'package:angel3_jael/angel3_jael.dart';

View file

@ -1,3 +1,4 @@
/// Custom plugins go here.
import 'dart:async'; import 'dart:async';
import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/angel3_framework.dart';

View file

@ -1,11 +0,0 @@
import 'package:angel3_serialize/angel3_serialize.dart';
import 'package:graphql_schema2/graphql_schema2.dart';
part 'todo.g.dart';
@graphQLClass
@serializable
abstract class _Todo extends Model {
String? get text;
bool? get isComplete;
}

View file

@ -1,155 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'todo.dart';
// **************************************************************************
// JsonModelGenerator
// **************************************************************************
@generatedSerializable
class Todo extends _Todo {
Todo({this.id, this.text, this.isComplete, this.createdAt, this.updatedAt});
@override
final String? id;
@override
final String? text;
@override
final bool? isComplete;
@override
final DateTime? createdAt;
@override
final DateTime? updatedAt;
Todo copyWith(
{String? id,
String? text,
bool? isComplete,
DateTime? createdAt,
DateTime? updatedAt}) {
return Todo(
id: id ?? this.id,
text: text ?? this.text,
isComplete: isComplete ?? this.isComplete,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt);
}
@override
bool operator ==(other) {
return other is _Todo &&
other.id == id &&
other.text == text &&
other.isComplete == isComplete &&
other.createdAt == createdAt &&
other.updatedAt == updatedAt;
}
@override
int get hashCode {
return hashObjects([id, text, isComplete, createdAt, updatedAt]);
}
@override
String toString() {
return 'Todo(id=$id, text=$text, isComplete=$isComplete, createdAt=$createdAt, updatedAt=$updatedAt)';
}
Map<String, dynamic> toJson() {
return TodoSerializer.toMap(this);
}
}
// **************************************************************************
// SerializerGenerator
// **************************************************************************
const TodoSerializer todoSerializer = TodoSerializer();
class TodoEncoder extends Converter<Todo, Map> {
const TodoEncoder();
@override
Map convert(Todo model) => TodoSerializer.toMap(model);
}
class TodoDecoder extends Converter<Map, Todo> {
const TodoDecoder();
@override
Todo convert(Map map) => TodoSerializer.fromMap(map);
}
class TodoSerializer extends Codec<Todo, Map> {
const TodoSerializer();
@override
TodoEncoder get encoder => const TodoEncoder();
@override
TodoDecoder get decoder => const TodoDecoder();
static Todo fromMap(Map map) {
return Todo(
id: map['id'] as String?,
text: map['text'] as String?,
isComplete: map['is_complete'] as bool?,
createdAt: map['created_at'] != null
? (map['created_at'] is DateTime
? (map['created_at'] as DateTime?)
: DateTime.parse(map['created_at'].toString()))
: null,
updatedAt: map['updated_at'] != null
? (map['updated_at'] is DateTime
? (map['updated_at'] as DateTime?)
: DateTime.parse(map['updated_at'].toString()))
: null);
}
static Map<String, dynamic> toMap(_Todo model) {
return {
'id': model.id,
'text': model.text,
'is_complete': model.isComplete,
'created_at': model.createdAt?.toIso8601String(),
'updated_at': model.updatedAt?.toIso8601String()
};
}
}
abstract class TodoFields {
static const List<String> allFields = <String>[
id,
text,
isComplete,
createdAt,
updatedAt
];
static const String id = 'id';
static const String text = 'text';
static const String isComplete = 'is_complete';
static const String createdAt = 'created_at';
static const String updatedAt = 'updated_at';
}
// **************************************************************************
// _GraphQLGenerator
// **************************************************************************
/// Auto-generated from [Todo].
final GraphQLObjectType todoGraphQLType =
objectType('Todo', isInterface: false, interfaces: [], fields: [
field('id', graphQLString),
field('text', graphQLString),
field('is_complete', graphQLBoolean),
field('created_at', graphQLDate),
field('updated_at', graphQLDate),
field('idAsInt', graphQLInt)
]);

View file

@ -1,20 +0,0 @@
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_graphql/angel3_graphql.dart';
import 'package:graphql_server2/graphql_server2.dart';
import 'schema.dart';
/// Configures the [app] to server GraphQL.
void configureServer(Angel app) {
// Create a [GraphQL] service instance, using our schema.
var schema = createSchema(app);
var graphQL = GraphQL(schema);
// Mount a handler that responds to GraphQL queries.
app.all('/graphql', graphQLHttp(graphQL));
// In development, serve the GraphiQL IDE/editor.
// More info: https://github.com/graphql/graphiql
if (!app.environment.isProduction) {
app.get('/graphiql', graphiQL());
}
}

View file

@ -1,22 +0,0 @@
import 'package:angel3_framework/angel3_framework.dart';
import 'package:graphql_schema2/graphql_schema2.dart';
import 'todo.dart';
/// Creates a GraphQL schema that manages an in-memory store of
/// Todo items.
GraphQLSchema createSchema(Angel app) {
var queryType = objectType(
'TodoQuery',
fields: todoQueryFields(app),
);
var mutationType = objectType(
'TodoMutation',
fields: todoMutationFields(app),
);
return graphQLSchema(
queryType: queryType,
mutationType: mutationType,
);
}

View file

@ -1,73 +0,0 @@
import 'package:angel/src/models/todo.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_graphql/angel3_graphql.dart';
import 'package:graphql_schema2/graphql_schema2.dart';
/// Find or create an in-memory Todo store.
MapService? _getTodoService(Angel app) {
const key = 'todoService';
// If there is already an existing singleton, return it.
if (app.container.hasNamed(key)) {
return app.container.findByName<MapService>(key);
}
// Create an in-memory service. We will use this
// as the backend to store Todo objects, serialized to Maps.
var mapService = MapService();
// Register this service as a named singleton in the app container,
// so that we do not inadvertently create another instance.
app.container.registerNamedSingleton(key, mapService);
return mapService;
}
/// Returns fields to be inserted into the query type.
Iterable<GraphQLObjectField> todoQueryFields(Angel app) {
var todoService = _getTodoService(app)!;
// Here, we use special resolvers to read data from our store.
return [
field(
'todos',
listOf(todoGraphQLType),
resolve: resolveViaServiceIndex(todoService),
),
field(
'todo',
todoGraphQLType,
resolve: resolveViaServiceRead(todoService),
inputs: [
GraphQLFieldInput('id', graphQLString.nonNullable()),
],
),
];
}
/// Returns fields to be inserted into the query type.
Iterable<GraphQLObjectField> todoMutationFields(Angel app) {
var todoService = _getTodoService(app)!;
var todoInputType = todoGraphQLType.toInputObject('TodoInput');
// This time, we use resolvers to modify the data in the store.
return [
field(
'createTodo',
todoGraphQLType,
resolve: resolveViaServiceCreate(todoService),
inputs: [
GraphQLFieldInput('data', todoInputType.nonNullable()),
],
),
field(
'modifyTodo',
todoGraphQLType,
resolve: resolveViaServiceModify(todoService),
inputs: [
GraphQLFieldInput('id', graphQLString.nonNullable()),
GraphQLFieldInput('data', todoInputType.nonNullable()),
],
),
];
}

View file

@ -1,8 +1,8 @@
/// This app's route configuration.
import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_static/angel3_static.dart'; import 'package:angel3_static/angel3_static.dart';
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'controllers/controllers.dart' as controllers; import 'controllers/controllers.dart' as controllers;
import 'graphql/graphql.dart' as graphql;
/// Put your app routes here! /// Put your app routes here!
/// ///
@ -14,9 +14,6 @@ AngelConfigurer configureServer(FileSystem fileSystem) {
// Typically, you want to mount controllers first, after any global middleware. // Typically, you want to mount controllers first, after any global middleware.
await app.configure(controllers.configureServer); await app.configure(controllers.configureServer);
// Mount our GraphQL routes as well.
await app.configure(graphql.configureServer);
// Render `views/hello.jl` when a user visits the application root. // Render `views/hello.jl` when a user visits the application root.
app.get('/', (req, res) => res.render('hello')); app.get('/', (req, res) => res.render('hello'));

View file

@ -1,3 +1,4 @@
/// Declare services here!
import 'dart:async'; import 'dart:async';
import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/angel3_framework.dart';

View file

@ -1,30 +1,25 @@
name: angel name: angel
description: A graphql starter application for Angel3 framework version: 1.0.0
description: A basic starter application template for Angel3 framework
publish_to: none publish_to: none
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=2.16.0 <3.0.0'
dependencies: dependencies:
angel3_auth: ^8.0.0 angel3_auth: ^6.0.0
angel3_configuration: ^8.0.0 angel3_configuration: ^6.0.0
angel3_framework: ^8.0.0 angel3_framework: ^6.0.0
angel3_graphql: ^8.0.0 angel3_jael: ^6.0.0
angel3_jael: ^8.0.0 angel3_production: ^6.0.0
angel3_production: ^8.0.0 angel3_static: ^6.0.0
angel3_container: ^8.0.0 angel3_validate: ^6.0.0
angel3_static: ^8.0.0 belatuk_pretty_logging: ^4.0.0
angel3_validate: ^8.0.0
angel3_serialize: ^8.0.0
graphql_server2: ^6.0.0
graphql_schema2: ^6.0.0
file: ^7.0.0
logging: ^1.2.0
dev_dependencies: dev_dependencies:
angel3_hot: ^8.0.0 angel3_hot: ^6.0.0
angel3_serialize_generator: ^8.0.0 angel3_test: ^6.0.0
angel3_test: ^8.0.0
graphql_generator2: ^6.0.0
belatuk_pretty_logging: ^6.0.0
build_runner: ^2.0.4
io: ^1.0.0 io: ^1.0.0
test: ^1.21.0 test: ^1.21.0
lints: ^2.1.1 lints: ^1.0.0

View file

@ -1,7 +1,7 @@
import 'package:angel/angel.dart';
import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_test/angel3_test.dart'; import 'package:angel3_test/angel3_test.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'package:angel/angel.dart';
// Angel also includes facilities to make testing easier. // Angel also includes facilities to make testing easier.
// //

View file

@ -1,8 +1,5 @@
<extend src="layout.jael"> <extend src="layout.jael">
<block name="content"> <block name="content">
<div class="title">Angel</div> <div class="title">Angel</div>
<p>
<a href="/graphiql">Click here</a> to access GraphiQL.
</p>
</block> </block>
</extend> </extend>

View file

@ -11,16 +11,6 @@ body {
font-family: 'Lato', sans-serif; font-family: 'Lato', sans-serif;
} }
a {
color: rgb(8, 114, 175) !important;
font-weight: 900;
text-decoration: none;
}
p {
font-size: 1.3em;
}
.container { .container {
text-align: center; text-align: center;
display: table-cell; display: table-cell;