https://github.com/artur-sulej/sandbox
Sandbox app that returns data mimicking production API. All data is generated without any persistence.
https://github.com/artur-sulej/sandbox
elixir phoenix-framework testing
Last synced: about 1 year ago
JSON representation
Sandbox app that returns data mimicking production API. All data is generated without any persistence.
- Host: GitHub
- URL: https://github.com/artur-sulej/sandbox
- Owner: Artur-Sulej
- Created: 2022-07-19T19:21:06.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-20T08:45:23.000Z (almost 4 years ago)
- Last Synced: 2025-06-10T22:53:05.446Z (about 1 year ago)
- Topics: elixir, phoenix-framework, testing
- Language: Elixir
- Homepage:
- Size: 89.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sandbox
## How to run?
### Local
To start your Phoenix server locally:
* Install dependencies with `mix deps.get`
* Start Phoenix endpoint with `mix phx.server`
* Server is running on [`localhost:4000`](http://localhost:4000)
### Tests
To run all `ExUnit` tests:
* Install dependencies with `mix deps.get`
* Run `mix test`
### Production
To generate release:
* Install dependencies with `mix deps.get --only prod`
* Assemble release with `MIX_ENV=prod mix release`
To start your Phoenix with production setup:
* `PHX_SERVER=true PHX_HOST=localhost PORT=4000 SECRET_KEY_BASE=secret_key_base _build/prod/rel/sandbox/bin/sandbox start`
* With default settings, server is running on [`localhost:4000`](http://localhost:4000)
## Authentication
* Use this script to generate encoded token: `elixir scripts/generate_token.exs test_123456`
* Add header to the request: `Authorization: Basic `
### Example request
```shell
curl --request GET \
--url http://localhost:4000/accounts \
--header 'Authorization: Basic dGVzdF8xMjM0NTY6'
```
## Metrics dashboard
You can visit [`/metrics`](http://localhost:4000/metrics) to see LiveView metrics with requests count.