protevus/README.md

81 lines
2.2 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
2021-09-25 10:45: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 `postgresql`. `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-03-15 05:25:51 +00:00
2. Install `postgresql` version 10, 11, 12 and 13
2021-07-17 04:52:48 +00:00
3. Create a new user and database in postgres using `psql` cli. For example:
2019-10-09 18:24:56 +00:00
2021-07-17 04:52:48 +00:00
```sql
postgres=# create database appdb;
postgres=# create user appuser with encrypted password 'App1970#';
postgres=# grant all privileges on database appdb to appuser;
```
2019-10-03 01:21:08 +00:00
2021-07-17 04:52:48 +00:00
4. Update the `postgres` 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
postgres:
host: localhost
port: 5432
database_name: appdb
username: appuser
password: App1970#
useSSL: false
time_zone: UTC
```
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:
```
http://localhost:3000/greetings/
```
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
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/).