This is a project that provides a starter-kit for a REST based web service. It provides best practices around Go web services using POD architecture and design. It contains the following features:
This project is using Go Module support for vendoring dependencies. We are using the `tidy` command to maintain the dependencies and make sure the project can create reproducible builds. This project assumes the source code will be inside your GOPATH within the traditional location.
A `makefile` has also been provide to make building, running and testing the software easier.
### Building the project
Navigate to the root of the project and use the `makefile` to build all of the services.
```
$ cd $GOPATH/src/geeks-accelerator/oss/saas-starter-kit/example-project
$ make all
```
### Running the project
Navigate to the root of the project and use the `makefile` to run all of the services.
```
$ cd $GOPATH/src/geeks-accelerator/oss/saas-starter-kit/example-project
$ make up
```
The `make up` command will leverage Docker Compose to run all the services, including the 3rd party services. The first time to run this command, Docker will download the required images for the 3rd party services.
Default configuration is set which should be valid for most systems. Use the `docker-compose.yaml` file to configure the services differently is necessary. Email me if you have issues or questions.
### Stopping the project
You can hit <ctrl>C in the terminal window running `make up`. Once that shutdown sequence is complete, it is important to run the `make down` command.
```
$ <ctrl>C
$ make down
```
Running `make down` will properly stop and terminate the Docker Compose session.
To make a request to the service you must have an authenticated user. Users can be created with the API but an initial admin user must first be created. While the service is running you can create the initial user with the command `make admin`
```
$ make admin
```
This will create a user with email `admin@example.com` and password `gophers`.
#### Authenticating
Before any authenticated requests can be sent you must acquire an auth token. Make a request using HTTP Basic auth with your email and password to get the token.