https://github.com/gilcierweb/api-elixir
API Elixir and PostgreSQL with Plug (Standalone)
https://github.com/gilcierweb/api-elixir
api-elixir elixir elixir-apps elixir-lang elixir-library elixir-plug elixir-wrapper postgresql
Last synced: 3 months ago
JSON representation
API Elixir and PostgreSQL with Plug (Standalone)
- Host: GitHub
- URL: https://github.com/gilcierweb/api-elixir
- Owner: gilcierweb
- Created: 2020-11-28T00:30:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-05T06:20:52.000Z (over 4 years ago)
- Last Synced: 2025-01-12T01:14:20.810Z (4 months ago)
- Topics: api-elixir, elixir, elixir-apps, elixir-lang, elixir-library, elixir-plug, elixir-wrapper, postgresql
- Language: Elixir
- Homepage:
- Size: 36.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# API Elixir and PostgreSQL with Plug (Standalone)
**Mix generate project without frameworks(No Phoenix, No Maru and etc)**
### Skills
- Elixir
- PostgreSQL### Setup Elixir (local)
https://asdf-vm.com/#/core-manage-asdfhttps://github.com/asdf-vm/asdf-erlang
https://github.com/asdf-vm/asdf-elixir
### Development without docker
```shell
mix do deps.get, deps.compile, compile
mix ecto.create
mix ecto.migrateMIX_ENV=test mix ecto.create
MIX_ENV=test mix ecto.migrate
MIX_ENV=test mix testiex -S mix
mix run --no-halt # run http://localhost:4000
```
run in local http://localhost:4000### List All Routes
```elixir
# get http://localhost:4000
# get http://localhost:4000/gilcierweb
# post http://localhost:4000/checkout # payload order
# get http://localhost:4000/checkout/success # success order payment gateway
# get http://localhost:4000/admin/authorized
# get http://localhost:4000/admin/unauthorized
# get http://localhost:4000/api/secret
# get http://localhost:4000/api/open
```post http://localhost:4000/checkout # payload order
```json
{
"id": 9987071,
"store_id": 282,
"date_created": "2019-06-24T16:45:32.000-04:00",
"date_closed": "2019-06-24T16:45:35.000-04:00",
"last_updated": "2019-06-25T13:26:49.000-04:00",
"total_amount": 49.9,
"total_shipping": 5.14,
"total_amount_with_shipping": 55.04,
"paid_amount": 55.04,
"expiration_date": "2019-07-22T16:45:35.000-04:00",
"total_shipping": 5.14,
"order_items": [
{
"item": {
"id": "IT4801901403",
"title": "Produto de Testes"
},
"quantity": 1,
"unit_price": 49.9,
"full_unit_price": 49.9
}
],
"payments": [
{
"id": 12312313,
"order_id": 9987071,
"payer_id": 414138,
"installments": 1,
"payment_type": "credit_card",
"status": "paid",
"transaction_amount": 49.9,
"taxes_amount": 0,
"shipping_cost": 5.14,
"total_paid_amount": 55.04,
"installment_amount": 55.04,
"date_approved": "2019-06-24T16:45:35.000-04:00",
"date_created": "2019-06-24T16:45:33.000-04:00"
}
],
"shipping": {
"id": 43444211797,
"shipment_type": "shipping",
"date_created": "2019-06-24T16:45:33.000-04:00",
"receiver_address": {
"id": 1051695306,
"address_line": "Rua Fake de Testes 3454",
"street_name": "Rua Fake de Testes",
"street_number": "3454",
"comment": "teste",
"zip_code": "85045020",
"city": {
"name": "Cidade de Testes"
},
"state": {
"name": "São Paulo"
},
"country": {
"id": "BR",
"name": "Brasil"
},
"neighborhood": {
"id": null,
"name": "Vila de Testes"
},
"latitude": -23.629037,
"longitude": -46.712689,
"receiver_phone": "41999999999"
}
},
"status": "paid",
"buyer": {
"id": 136226073,
"nickname": "JOHN DOE",
"email": "[email protected]",
"phone": {
"area_code": 41,
"number": "999999999"
},
"first_name": "John",
"last_name": "Doe",
"billing_info": {
"doc_type": "CPF",
"doc_number": "09487965477"
}
}
}
```
### Development with docker and docker-compose
```shell
docker-compose build
docker-compose up # run http://localhost:4000
docker-compose run --rm web mix ecto.create
docker-compose run --rm web mix ecto.migrate
docker-compose run --rm web bash
```run with docker http://localhost:4000
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/api_elixir](https://hexdocs.pm/api_elixir).https://gilcierweb.com.br/