semvec/pypi-packages huggingface dataset:
apisrun 0.0.3
Apisrun CLI, is a tool to create microservices in an agile way.
License: MIT
Requires Python: >=3.7,<4.0
Keywords: Poetry,CLI,Apisrun,Packages,Packaging

# What's Apisrun ?

Apisrun is a tool to create microservices in an agile way. this CLI allows you to create one or more API through a manifest and a simple command.

## Installation

```bash
pip install apisrun
```

## How does it work

To start creating api we need to create a manifest. `apisrun.yml`

```yml
# This is an example manifest to create microservices in apisrun.

myapi: # Microservices name.

  # first endpoint
  - model: users # Model name.
    path: /users/ # Path name.
    schema: # Schema of data structure.
      username:
        type: string
        required: true
      age:
        type: integer
        required: true
      is_admin:
        type: boolean
        required: true
      level:
        type: string

  # second endpoint
  - model: inventory # Model name.
    path: /inventories/ # Path name.
    schema: # Schema of data structure.
      product:
        type: string
        required: true
      value:
        type: integer
        required: true
```

* path: is the url that your new resource, must be unique.
* schema: is the data structure to be persisted in the new resource. by default it is based on [cerberus](https://docs.python-cerberus.org/en/stable/index.html).
* model: is the name that identifies your resource. must be unique.

### Publishing microservices

```bash
apisrun up -f examples/apisrun.yml

🔄 Creating DB Container `myapi`.
🟢 DB Container `myapi` is ready and listening on port 27017.
🔄 Creating Api Container `myapi`.
🟢 Api Container `myapi` is ready and listening on port 8000.
🆙 Pushing data to Api `myapi`.
```

Once created, the services are available to be consumed.

defaults:
* API Health `GET http://localhost:8000/ping/`
* Administration `GET|POST http://localhost:8000/admin/nodes/`

by the user:
* first endpoint `GET|POST|PUT|PATCH|DELETE http://localhost:8000/users/`
* second endpoint `GET|POST|PUT|PATCH|DELETE http://localhost:8000/inventories/`

DB config default `mongodb://apisrun:password@ip:27017/`

[More Info](https://github.com/josesalasdev/apisrun)

### Listing microservices

```bash
apisrun list

┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Container           ┃  Status ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩
│ myapi_apisrun       │ running │
│ myapi_mongo_apisrun │ running │
└─────────────────────┴─────────┘
```

### Kill microservices
```bash
apisrun down

✨ Your apis were removed. ✨
```