update readme and base url used in api response.
This commit is contained in:
@@ -20,7 +20,7 @@ class Controller extends BaseController
|
|||||||
protected function JsonApiResponse(ResourceInterface $resource, $statusCode, $includes = '')
|
protected function JsonApiResponse(ResourceInterface $resource, $statusCode, $includes = '')
|
||||||
{
|
{
|
||||||
$manager = app('FractalManager');
|
$manager = app('FractalManager');
|
||||||
$manager->setSerializer(new JsonApiSerializer('http://docker.dev:8080'));
|
$manager->setSerializer(new JsonApiSerializer('https://tripbuilder.xai-corp.net'));
|
||||||
$manager->parseIncludes($includes);
|
$manager->parseIncludes($includes);
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray(), $statusCode);
|
return response()->json($manager->createData($resource)->toArray(), $statusCode);
|
||||||
|
|||||||
40
readme.md
40
readme.md
@@ -1,10 +1,15 @@
|
|||||||
# Trip Builder
|
# Trip Builder
|
||||||
- Richard Morgan <r_morgan@sympatico.ca>
|
Richard Morgan <r_morgan@sympatico.ca>
|
||||||
|
|
||||||
Test application based on Laravel Lumen 5.4, running on docker containers.
|
Test application based on Laravel Lumen 5.4, running on docker containers.
|
||||||
|
|
||||||
## Launch Environment
|
The Response is alway json, in the [json-api](http://jsonapi.org/) format.
|
||||||
The dev environment is docker based. To run the php app, nginx, postgres database, and redis cache containers, simply run docker-compose up
|
|
||||||
|
## Dev Environment
|
||||||
|
The dev environment is docker based. To run the php app, nginx, postgres database, and redis cache containers.
|
||||||
|
|
||||||
|
### launch
|
||||||
|
simply run docker-compose up
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -14,16 +19,41 @@ docker-compose up
|
|||||||
This will download the required base images, then build the additional tools into new images, and then launch new containers.
|
This will download the required base images, then build the additional tools into new images, and then launch new containers.
|
||||||
A container also runs briefly to generate the api docs.
|
A container also runs briefly to generate the api docs.
|
||||||
|
|
||||||
## Setup database
|
### First run
|
||||||
|
The zip file contains all the necessary files. If you cloned the git repo, you will need to run composer to
|
||||||
|
fetch third party packages.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Setup database
|
||||||
|
Before testing the app, you will need to prepare the database.
|
||||||
Database migrations and seeds are provided for testing the app. These can be run in docker with the following command:
|
Database migrations and seeds are provided for testing the app. These can be run in docker with the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose exec app php artisan migrate:refresh --seed
|
docker-compose exec app php artisan migrate:refresh --seed
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### testing
|
||||||
|
Some tests are provided, powered by [codeception](http://codeception.com/).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose exec app vendor/bin/codecept run
|
||||||
|
```
|
||||||
|
|
||||||
## Api Documentation
|
## Api Documentation
|
||||||
|
Api documentation is automatically generated using [apidocjs](http://apidocjs.com) within a container.
|
||||||
The docker containers expose the api documentation on [http://localhost:8080/docs/](http://localhost:8080/docs/)
|
The docker containers expose the api documentation on [http://localhost:8080/docs/](http://localhost:8080/docs/)
|
||||||
|
|
||||||
|
As well as describing each api endpoint, the docs include forms for testing the api.
|
||||||
|
|
||||||
##
|
You can regenerate the docs with the following command
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up apidocs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing online
|
||||||
|
The api is available online at [https://tripbuilder.xai-corp.net](https://tripbuilder.xai-corp.net).
|
||||||
|
And the docs are available at [https://tripbuilder.xai-corp.net/docs/](https://tripbuilder.xai-corp.net)
|
||||||
|
|||||||
Reference in New Issue
Block a user