Compare commits
27 commits
angel3-gra
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
d6a81afab5 | ||
|
fd4abfaf43 | ||
|
d171e49fc2 | ||
|
debada01f2 | ||
|
4bdddcdfed | ||
|
023d239c1f | ||
|
6867696218 | ||
|
f46ec8058d | ||
|
597ea5323a | ||
|
8a6bd74bf2 | ||
|
2f8dd31c6a | ||
|
dfd864f0b7 | ||
|
9e66a1af47 | ||
|
be518fa3c0 | ||
|
197e4c95e5 | ||
|
89dde22a52 | ||
|
539696222d | ||
|
c19f92ba35 | ||
|
d74bde03e2 | ||
|
e986fca7bb | ||
|
41d83a274b | ||
|
528dca2db9 | ||
|
93cdb671d5 | ||
|
ff8b0e60a8 | ||
|
00b14878a8 | ||
|
4f1913d517 | ||
|
a8dc7ef515 |
20 changed files with 97 additions and 333 deletions
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: [thosakwe]
|
28
.gitignore
vendored
28
.gitignore
vendored
|
@ -11,6 +11,7 @@
|
|||
.project
|
||||
.pub/
|
||||
.scripts-bin/
|
||||
.metals/
|
||||
build/
|
||||
**/packages/
|
||||
|
||||
|
@ -37,7 +38,27 @@ pubspec.lock
|
|||
|
||||
# User-specific stuff:
|
||||
.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:
|
||||
*.iws
|
||||
|
@ -60,8 +81,11 @@ crashlytics-build.properties
|
|||
fabric.properties
|
||||
|
||||
### VSCode template
|
||||
.vscode/
|
||||
.metals/
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
logs/
|
||||
*.pem
|
||||
|
|
12
AUTHORS.md
Normal file
12
AUTHORS.md
Normal 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
25
CONTRIBUTING.md
Normal 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
|
|
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
||||
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/).
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import 'dart:io';
|
||||
import 'package:logging/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_framework/angel3_framework.dart';
|
||||
import 'package:angel3_hot/angel3_hot.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:angel/angel.dart';
|
||||
|
||||
void main() async {
|
||||
// Watch the config/ and web/ directories for changes, and hot-reload the server.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:angel/angel.dart';
|
||||
import 'package:angel3_container/mirrors.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
|
||||
// reflector, by default.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/// Configuration for this Angel instance.
|
||||
import 'package:angel3_configuration/angel3_configuration.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_jael/angel3_jael.dart';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/// Custom plugins go here.
|
||||
import 'dart:async';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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)
|
||||
]);
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
);
|
||||
}
|
|
@ -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()),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/// This app's route configuration.
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_static/angel3_static.dart';
|
||||
import 'package:file/file.dart';
|
||||
import 'controllers/controllers.dart' as controllers;
|
||||
import 'graphql/graphql.dart' as graphql;
|
||||
|
||||
/// Put your app routes here!
|
||||
///
|
||||
|
@ -14,9 +14,6 @@ AngelConfigurer configureServer(FileSystem fileSystem) {
|
|||
// Typically, you want to mount controllers first, after any global middleware.
|
||||
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.
|
||||
app.get('/', (req, res) => res.render('hello'));
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/// Declare services here!
|
||||
import 'dart:async';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
|
||||
|
|
45
pubspec.yaml
45
pubspec.yaml
|
@ -1,30 +1,25 @@
|
|||
name: angel
|
||||
description: A graphql starter application for Angel3 framework
|
||||
publish_to: none
|
||||
version: 1.0.0
|
||||
description: A basic starter application template for Angel3 framework
|
||||
publish_to: none
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
sdk: '>=2.16.0 <3.0.0'
|
||||
dependencies:
|
||||
angel3_auth: ^8.0.0
|
||||
angel3_configuration: ^8.0.0
|
||||
angel3_framework: ^8.0.0
|
||||
angel3_graphql: ^8.0.0
|
||||
angel3_jael: ^8.0.0
|
||||
angel3_production: ^8.0.0
|
||||
angel3_container: ^8.0.0
|
||||
angel3_static: ^8.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
|
||||
angel3_auth: ^6.0.0
|
||||
angel3_configuration: ^6.0.0
|
||||
angel3_framework: ^6.0.0
|
||||
angel3_jael: ^6.0.0
|
||||
angel3_production: ^6.0.0
|
||||
angel3_static: ^6.0.0
|
||||
angel3_validate: ^6.0.0
|
||||
belatuk_pretty_logging: ^4.0.0
|
||||
dev_dependencies:
|
||||
angel3_hot: ^8.0.0
|
||||
angel3_serialize_generator: ^8.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
|
||||
angel3_hot: ^6.0.0
|
||||
angel3_test: ^6.0.0
|
||||
io: ^1.0.0
|
||||
test: ^1.21.0
|
||||
lints: ^2.1.1
|
||||
lints: ^1.0.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:angel/angel.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_test/angel3_test.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:angel/angel.dart';
|
||||
|
||||
// Angel also includes facilities to make testing easier.
|
||||
//
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
<extend src="layout.jael">
|
||||
<block name="content">
|
||||
<div class="title">Angel</div>
|
||||
<p>
|
||||
<a href="/graphiql">Click here</a> to access GraphiQL.
|
||||
</p>
|
||||
</block>
|
||||
</extend>
|
|
@ -11,16 +11,6 @@ body {
|
|||
font-family: 'Lato', sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: rgb(8, 114, 175) !important;
|
||||
font-weight: 900;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.container {
|
||||
text-align: center;
|
||||
display: table-cell;
|
||||
|
|
Loading…
Reference in a new issue