Update fbla-api/README.md
This commit is contained in:
parent
5e1b1e3a1f
commit
9b8dcda882
@ -3,18 +3,15 @@ This is the API for my 2023-2024 FBLA Coding & Programming App
|
||||
## Installation
|
||||
|
||||
1. Install [Dart SDK](https://dart.dev/get-dart)
|
||||
2. Install [PostgreSQL](https://www.postgresql.org/) and set it up
|
||||
3. Clone the repo
|
||||
```
|
||||
2. Clone the repo
|
||||
```bash
|
||||
git clone https://git.marinodev.com/MarinoDev/FBLA24.git
|
||||
cd FBLA24/fbla-api/
|
||||
```
|
||||
4. Run `dart pub install` to install dart packages
|
||||
|
||||
## Usage
|
||||
|
||||
1. Create `fbla` database in postgres
|
||||
```
|
||||
3. Run `dart pub install` to install dart packages
|
||||
4. Install [PostgreSQL](https://www.postgresql.org/) and set it up.
|
||||
5. Create `fbla` database in postgres
|
||||
```SQL
|
||||
CREATE DATABASE fbla
|
||||
WITH
|
||||
OWNER = [username]
|
||||
@ -24,8 +21,8 @@ CREATE DATABASE fbla
|
||||
```
|
||||
Make sure to change [username] to the actual username of your postgres instance.
|
||||
|
||||
2. Create `businesses` table
|
||||
```
|
||||
6. Create `businesses` table
|
||||
```SQL
|
||||
-- Table: public.businesses
|
||||
|
||||
-- DROP TABLE IF EXISTS public.businesses;
|
||||
@ -52,9 +49,8 @@ ALTER TABLE IF EXISTS public.businesses
|
||||
OWNER to [username];
|
||||
```
|
||||
Make sure to change [username] to the actual username of your postgres instance
|
||||
|
||||
3. Create `users` table
|
||||
```
|
||||
7. Create `users` table
|
||||
```SQL
|
||||
-- Table: public.users
|
||||
|
||||
-- DROP TABLE IF EXISTS public.users;
|
||||
@ -73,9 +69,22 @@ TABLESPACE pg_default;
|
||||
ALTER TABLE IF EXISTS public.users
|
||||
OWNER to postgres;
|
||||
```
|
||||
4. Set environment variables `POSTGRES_ADDRESS` (IP address), `POSTGRES_PORT` (default 5432), `POSTGRES_USERNAME`, and `POSTGRES_PASSWORD` to appropriate information for your postgres database. Also set `SECRET_KEY` to anything you want to genera te JSON Web Tokens.
|
||||
5. Set lib/create_first_user.dart username and password variables at top of file and run with `dart run lib/create_first_user.dart`
|
||||
8. Set environment variables `POSTGRES_ADDRESS` (IP address), `POSTGRES_PORT` (default 5432), `POSTGRES_USERNAME`, and `POSTGRES_PASSWORD` to appropriate information for your postgres database. Also set `SECRET_KEY` to anything you want to genera te JSON Web Tokens.
|
||||
9. Set lib/create_first_user.dart username and password variables at top of file and run with `dart run lib/create_first_user.dart`
|
||||
Note: the username and password you use here will be what you use to log into the app as an admin
|
||||
6. Your database should be all set up! Start the API with `dart run lib/fbla_api.dart` or alternatively, run it in a docker container with [Docker Build](https://docs.docker.com/reference/cli/docker/image/build/) and [Docker Compose](https://docs.docker.com/compose/) using the included [Dockerfile](Dockerfile) and [docker-compose.yml](docker-compose.yml) files. If using `Docker Compose`, change the first portion of the volumes path on line 9 to any desired storage location.
|
||||
|
||||
## Usage
|
||||
|
||||
### Installed
|
||||
|
||||
Start the API with `dart run lib/fbla_api.dart`\
|
||||
Note the address it is serving at, you will need this to connect it to the UI, and to run tests.
|
||||
7. Test your api with `dart run test/fbla_api_test.dart`, setting `apiAddress` on line 8 to your api address.
|
||||
|
||||
### Docker
|
||||
|
||||
Run it in a docker container with [Docker Build](https://docs.docker.com/reference/cli/docker/image/build/) and [Docker Compose](https://docs.docker.com/compose/) using the included [Dockerfile](Dockerfile) and [docker-compose.yml](docker-compose.yml) files. If using `Docker Compose`, change the first portion of the volumes path on line 9 to any desired storage location.\
|
||||
Note the address it is serving at, you will need this to connect it to the UI, and to run tests.
|
||||
|
||||
### Testing
|
||||
|
||||
You can test all functionality of your api with `dart run test/fbla_api_test.dart`, setting `apiAddress` on line 8 to your api address.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user