protevus/README.md

87 lines
2.3 KiB
Markdown
Raw Permalink Normal View History

2021-07-17 04:52:48 +00:00
# ORM Starter Application for Angel3 framework
2021-06-11 04:08:20 +00:00
2022-04-30 02:14:23 +00:00
This is an ORM starter application for [Angel3 framework](https://angel3-framework.web.app) which is a full-stack Web framework in Dart. The default database is MariaDB. MySQL support is still in active development.
2016-12-27 14:28:48 +00:00
2021-07-17 04:52:48 +00:00
## Installation & Setup
2018-12-11 03:36:14 +00:00
2021-07-17 04:52:48 +00:00
1. Download and install [Dart](https://dart.dev/get-dart).
2022-04-30 02:14:23 +00:00
2. Install `MariaDB` 10.2.x or later
3. Create a new user and database using MySQL Client. For example:
2019-10-09 18:24:56 +00:00
2021-07-17 04:52:48 +00:00
```sql
2022-04-30 02:14:23 +00:00
MariaDB [(none)]> CREATE DATABASE appdb;
MariaDB [(none)]> CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'App1970#';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'localhost';
2021-07-17 04:52:48 +00:00
```
2019-10-03 01:21:08 +00:00
2022-04-30 02:14:23 +00:00
4. Update the `mariadb` section in the `config/default.yaml` file with the newly created user and database name.
2017-06-05 17:01:45 +00:00
2021-07-17 04:52:48 +00:00
```yaml
2022-04-30 02:14:23 +00:00
mariadb:
2021-07-17 04:52:48 +00:00
host: localhost
2022-04-30 02:14:23 +00:00
port: 3306
2021-07-17 04:52:48 +00:00
database_name: appdb
username: appuser
password: App1970#
```
2017-04-02 20:32:03 +00:00
2021-07-25 09:11:58 +00:00
5. Run the migration to generate `migrations` and `greetings` tables in the database.
```bash
2022-02-04 02:32:26 +00:00
dart bin/migrate.dart up
2021-07-25 09:11:58 +00:00
```
2021-07-17 04:52:48 +00:00
### Development
2017-04-02 20:28:22 +00:00
2021-07-17 04:52:48 +00:00
1. Run the following command to start Angel3 server in dev mode to *hot-reloaded* on file changes:
2017-04-02 20:28:22 +00:00
2021-07-17 04:52:48 +00:00
```bash
dart --observe bin/dev.dart
```
2017-04-02 20:32:03 +00:00
2021-07-17 04:52:48 +00:00
2. Modify the code and watch the changes applied to the application
2017-04-02 20:32:03 +00:00
2022-02-04 02:32:26 +00:00
3. Insert a message into DB:
2022-03-15 05:25:51 +00:00
```bash
2022-02-04 02:32:26 +00:00
curl -H "Content-Type: application/json" -X POST -d '{"message":"OK_Message" }' "http://localhost:3000/greetings/"
```
or
2022-03-15 05:25:51 +00:00
```bash
2022-02-04 02:32:26 +00:00
curl -X POST -d 'message=OK_Message2' "http://localhost:3000/greetings/"
```
4. Query DB:
2022-04-30 02:14:23 +00:00
```bash
curl http://localhost:3000/greetings/
2022-02-04 02:32:26 +00:00
```
2022-03-15 05:25:51 +00:00
2021-07-17 04:52:48 +00:00
### Production
2017-04-02 20:32:03 +00:00
2021-07-17 04:52:48 +00:00
1. Run the following command:
2017-04-02 20:38:20 +00:00
2021-07-17 04:52:48 +00:00
```bash
dart bin/prod.dart
```
2017-04-02 20:38:20 +00:00
2021-07-17 04:52:48 +00:00
2. Run as docker. Edit and run the provided `Dockerfile` to build the image.
2017-04-02 20:32:03 +00:00
2022-04-30 02:14:23 +00:00
### Building ORM Model
1. Run the followig command:
```bash
dart run build_runner build
```
2021-07-17 04:52:48 +00:00
## Resources
2019-04-18 16:18:39 +00:00
2021-07-17 04:52:48 +00:00
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.
2019-04-18 16:18:39 +00:00
2021-09-25 10:45:23 +00:00
Examples and complete projects can be found [here](https://angel3-framework.web.app/#/examples).
2019-04-18 16:18:39 +00:00
2021-06-11 04:00:10 +00:00
You can also view the [API Documentation](https://pub.dev/documentation/angel3_framework/latest/).