Updated ORM
This commit is contained in:
parent
a32652b683
commit
fab33a543c
20 changed files with 86 additions and 149 deletions
3
.github/FUNDING.yml
vendored
3
.github/FUNDING.yml
vendored
|
@ -1,3 +0,0 @@
|
||||||
# These are supported funding model platforms
|
|
||||||
|
|
||||||
github: [thosakwe]
|
|
|
@ -1,16 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.pub" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="Dart SDK" level="project" />
|
|
||||||
<orderEntry type="library" name="Dart Packages" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="JavaScriptSettings">
|
|
||||||
<option name="languageLevel" value="ES6" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
|
||||||
<entry key="Project Default">
|
|
||||||
<profile-state>
|
|
||||||
<expanded-state>
|
|
||||||
<State>
|
|
||||||
<id />
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>General</id>
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>XPath</id>
|
|
||||||
</State>
|
|
||||||
</expanded-state>
|
|
||||||
<selected-state>
|
|
||||||
<State>
|
|
||||||
<id>AngularJS</id>
|
|
||||||
</State>
|
|
||||||
</selected-state>
|
|
||||||
</profile-state>
|
|
||||||
</entry>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/angel.iml" filepath="$PROJECT_DIR$/.idea/angel.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="dev.dart" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application" singleton="true" nameIsGenerated="true">
|
|
||||||
<option name="VMOptions" value="--observe" />
|
|
||||||
<option name="filePath" value="$PROJECT_DIR$/bin/dev.dart" />
|
|
||||||
<option name="workingDirectory" value="$PROJECT_DIR$" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="prod.dart" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application" singleton="true" nameIsGenerated="true">
|
|
||||||
<option name="checkedMode" value="false" />
|
|
||||||
<option name="envs">
|
|
||||||
<entry key="ANGEL_ENV" value="production" />
|
|
||||||
</option>
|
|
||||||
<option name="filePath" value="$PROJECT_DIR$/bin/prod.dart" />
|
|
||||||
<option name="workingDirectory" value="$PROJECT_DIR$" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,2 +1,8 @@
|
||||||
# 1.0.0
|
# Change Log
|
||||||
* Application template to build web application with `Angel3` framework
|
|
||||||
|
## 1.0.0
|
||||||
|
|
||||||
|
* Changed to use `angel3` packages
|
||||||
|
* Updated to support NNBD
|
||||||
|
* Updated README
|
||||||
|
* Updated default `postgresql` setup
|
||||||
|
|
|
@ -1,3 +1,24 @@
|
||||||
# Contributing Angel3
|
# Contribution
|
||||||
|
|
||||||
Any contributions from the community are welcome.
|
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
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2016 dukefirehawk.com
|
Copyright (c) 2021 dukefirehawk.com
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
83
README.md
83
README.md
|
@ -1,61 +1,58 @@
|
||||||
[![Angel 3 Framework](./logo3.png)](https://github.com/dukefirehawk/angel)
|
# ORM Starter Application for Angel3 framework
|
||||||
|
|
||||||
[![Version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_framework)
|
This is an ORM starter application for [Angel3 framework](https://pub.dartlang.org/packages/angel3_framework) which is a full-stack Web framework in Dart. The default database is `postgresql`. `mysql` support is still in active development.
|
||||||
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
|
|
||||||
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
|
|
||||||
|
|
||||||
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/boilerplates/blob/angel3-orm/LICENSE)
|
|
||||||
|
|
||||||
**A polished, production-ready backend framework in Dart.**
|
|
||||||
|
|
||||||
*Note: This repo is an application boilerplate ,and not the underlying framework library.*
|
|
||||||
|
|
||||||
-----
|
|
||||||
## About
|
|
||||||
Angel is a full-stack Web framework in Dart. It aims to
|
|
||||||
streamline development by providing many common features
|
|
||||||
out-of-the-box in a consistent manner.
|
|
||||||
|
|
||||||
With features like the following, Angel is the all-in-one framework you should choose to build your next project:
|
|
||||||
* [GraphQL Support](https://github.com/dukefirehawk/angel/tree/master/packages/graphql)
|
|
||||||
* [PostgreSQL ORM](https://github.com/dukefirehawk/angel/tree/master/packages/orm)
|
|
||||||
* [Dependency Injection](https://angel3-docs.dukefirehawk.com/guides/dependency-injection)
|
|
||||||
* And [much more](https://github.com/dukefirehawk/angel)...
|
|
||||||
|
|
||||||
## Installation & Setup
|
## Installation & Setup
|
||||||
|
|
||||||
Once you have [Dart](https://dart.dev/get-dart) installed, bootstrapping a project is as simple as running a few shell commands:
|
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**
|
||||||
|
3. Create a new user and database in postgres using `psql` cli. For example:
|
||||||
|
|
||||||
Install the [Angel3 CLI](https://github.com/dukefirehawk/angel3-cli):
|
```sql
|
||||||
|
postgres=# create database appdb;
|
||||||
|
postgres=# create user appuser with encrypted password 'App1970#';
|
||||||
|
postgres=# grant all privileges on database appdb to appuser;
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
4. Update the `postgres` section in the `config/default.yaml` file with the newly created user and database name.
|
||||||
pub global activate angel3_cli
|
|
||||||
```
|
|
||||||
|
|
||||||
Bootstrap a project:
|
```yaml
|
||||||
|
postgres:
|
||||||
|
host: localhost
|
||||||
|
port: 5432
|
||||||
|
database_name: appdb
|
||||||
|
username: appuser
|
||||||
|
password: App1970#
|
||||||
|
useSSL: false
|
||||||
|
time_zone: UTC
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
### Development
|
||||||
angel init hello
|
|
||||||
```
|
|
||||||
|
|
||||||
You can even have your server run and be *hot-reloaded* on file changes:
|
1. Run the following command to start Angel3 server in dev mode to *hot-reloaded* on file changes:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
dart --observe bin/dev.dart
|
dart --observe bin/dev.dart
|
||||||
```
|
```
|
||||||
|
|
||||||
Next, check out the [detailed documentation](https://angel3-docs.dukefirehawk.com/guides) to learn to flesh out your project.
|
2. Modify the code and watch the changes applied to the application
|
||||||
|
|
||||||
## Examples and Documentation
|
### Production
|
||||||
Visit the [documentation](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 Angel.
|
|
||||||
|
|
||||||
Examples and complete projects can be found
|
1. Run the following command:
|
||||||
[here](https://github.com/dukefirehawk/angel3-examples).
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dart bin/prod.dart
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Run as docker. Edit and run the provided `Dockerfile` to build the image.
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
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://github.com/dukefirehawk/angel3-examples).
|
||||||
|
|
||||||
You can also view the [API Documentation](https://pub.dev/documentation/angel3_framework/latest/).
|
You can also view the [API Documentation](https://pub.dev/documentation/angel3_framework/latest/).
|
||||||
|
|
||||||
There is also an [Awesome Angel :fire:](https://github.com/dukefirehawk/angel3-awesome) list.
|
There is also an [Awesome Angel :fire:](https://github.com/dukefirehawk/angel3-awesome) list.
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
# Default server configuration.
|
# Default server configuration.
|
||||||
jwt_secret: INSECURE_DEFAULT_SECRET
|
jwt_secret: INSECURE_DEFAULT_SECRET
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
# mongo_db: mongodb://localhost:27017/angel
|
|
||||||
port: 3000
|
port: 3000
|
||||||
postgres:
|
postgres:
|
||||||
database_name: angel
|
host: localhost
|
||||||
username: angel
|
port: 5432
|
||||||
password: angel2020
|
database_name: appdb
|
||||||
|
username: appuser
|
||||||
|
password: App1970#
|
||||||
|
useSSL: false
|
||||||
|
time_zone: UTC
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
/// Your very own web application!
|
/// Your very own web application!
|
||||||
library angel;
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:angel3_framework/angel3_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:file/local.dart';
|
import 'package:file/local.dart';
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/// Configuration for this Angel instance.
|
|
||||||
library angel.src.config;
|
|
||||||
|
|
||||||
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';
|
||||||
|
|
|
@ -24,7 +24,8 @@ Future<PostgreSQLConnection> connectToPostgres(Map configuration) async {
|
||||||
postgresConfig['port'] as int? ?? 5432,
|
postgresConfig['port'] as int? ?? 5432,
|
||||||
postgresConfig['database_name'] as String? ??
|
postgresConfig['database_name'] as String? ??
|
||||||
Platform.environment['USER'] ??
|
Platform.environment['USER'] ??
|
||||||
Platform.environment['USERNAME']!,
|
Platform.environment['USERNAME'] ??
|
||||||
|
'',
|
||||||
username: postgresConfig['username'] as String?,
|
username: postgresConfig['username'] as String?,
|
||||||
password: postgresConfig['password'] as String?,
|
password: postgresConfig['password'] as String?,
|
||||||
timeZone: postgresConfig['time_zone'] as String? ?? 'UTC',
|
timeZone: postgresConfig['time_zone'] as String? ?? 'UTC',
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/// Custom plugins go here.
|
|
||||||
library angel.src.config.plugins;
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:angel3_framework/angel3_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'orm.dart' as orm;
|
import 'orm.dart' as orm;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
library angel.src.routes.controllers;
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:angel3_framework/angel3_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/// This app's route configuration.
|
|
||||||
library angel.src.routes;
|
|
||||||
|
|
||||||
import 'package:angel3_framework/angel3_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel3_orm/angel3_orm.dart';
|
import 'package:angel3_orm/angel3_orm.dart';
|
||||||
import 'package:angel3_static/angel3_static.dart';
|
import 'package:angel3_static/angel3_static.dart';
|
||||||
|
@ -11,8 +8,8 @@ import '../models/greeting.dart';
|
||||||
/// Put your app routes here!
|
/// Put your app routes here!
|
||||||
///
|
///
|
||||||
/// See the wiki for information about routing, requests, and responses:
|
/// See the wiki for information about routing, requests, and responses:
|
||||||
/// * https://github.com/angel-dart/angel/wiki/Basic-Routing
|
/// * https://angel3-docs.dukefirehawk.com/guides/basic-routing
|
||||||
/// * https://github.com/angel-dart/angel/wiki/Requests-&-Responses
|
/// * https://angel3-docs.dukefirehawk.com/guides/requests-and-responses
|
||||||
AngelConfigurer configureServer(FileSystem fileSystem) {
|
AngelConfigurer configureServer(FileSystem fileSystem) {
|
||||||
return (Angel app) async {
|
return (Angel app) async {
|
||||||
// Typically, you want to mount controllers first, after any global middleware.
|
// Typically, you want to mount controllers first, after any global middleware.
|
||||||
|
@ -55,7 +52,7 @@ AngelConfigurer configureServer(FileSystem fileSystem) {
|
||||||
//
|
//
|
||||||
// Read the following two sources for documentation:
|
// Read the following two sources for documentation:
|
||||||
// * https://medium.com/the-angel-framework/serving-static-files-with-the-angel-framework-2ddc7a2b84ae
|
// * https://medium.com/the-angel-framework/serving-static-files-with-the-angel-framework-2ddc7a2b84ae
|
||||||
// * https://github.com/angel-dart/static
|
// * https://pub.dev/packages/angel3_static
|
||||||
if (!app.environment.isProduction) {
|
if (!app.environment.isProduction) {
|
||||||
var vDir = VirtualDirectory(
|
var vDir = VirtualDirectory(
|
||||||
app,
|
app,
|
||||||
|
@ -71,7 +68,7 @@ AngelConfigurer configureServer(FileSystem fileSystem) {
|
||||||
// Set our application up to handle different errors.
|
// Set our application up to handle different errors.
|
||||||
//
|
//
|
||||||
// Read the following for documentation:
|
// Read the following for documentation:
|
||||||
// * https://github.com/angel-dart/angel/wiki/Error-Handling
|
// * https://angel3-docs.dukefirehawk.com/guides/error-handling
|
||||||
|
|
||||||
var oldErrorHandler = app.errorHandler;
|
var oldErrorHandler = app.errorHandler;
|
||||||
app.errorHandler = (e, req, res) async {
|
app.errorHandler = (e, req, res) async {
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/// Declare services here!
|
|
||||||
library angel.services;
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:angel3_framework/angel3_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
|
|
||||||
|
|
BIN
logo3.png
BIN
logo3.png
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
|
@ -1,10 +1,9 @@
|
||||||
name: angel
|
name: angel
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
description: A boilerplate template for building Angel3 application with ORM enabled
|
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.12.0 <3.0.0'
|
||||||
homepage: https://github.com/dukefirehawk/boilerplates
|
|
||||||
dependencies:
|
dependencies:
|
||||||
angel3_auth: ^4.0.0
|
angel3_auth: ^4.0.0
|
||||||
angel3_configuration: ^4.0.0
|
angel3_configuration: ^4.0.0
|
||||||
|
|
Loading…
Reference in a new issue