DEV Community

Nicol Acosta
Nicol Acosta

Posted on

API Prototypes with dbb: A little more than a prototype

First Post to know the basic about dbb

Introduction

In the last post i added the basics about dbb and since the date, i added a little bit of features, trying to make more helpful and automated so, here it's the changes

Schema file validation

Now you the system wouln't start if your schema file hasn't the right format, this ensure all it's rightly configured in your file, not a great thing

Webhooks

Before this, the API was just a simple CRUD without any other kind of trick, now this changes all, because you can define, in any call to a specific action a webhook call to any endpoint, with the data in the body

{
  "schemas": [
    {
      "name": "table_name",
      "fields": {
        "some_field": "string"
      },
      "hooks": [
        {
          "events": ["index", "create", "update"],
          "url": "https://some.site/some/hook",
          "method": "get",
          "headers": {
            "key": "value"
          }
        }
      ]
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

You can specify your webhook auth in case that it's needed

New Datatypes

Now you can define in your schema the UUID's and Datetimes (Or Date and Time)

{
  "schemas": [
    {
      "name": "table_name",
      "fields": {
        "date_field": "date",
        "time_field": "time",
        "datetime_field": "datetime"
      }
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Swagger UI

Now automatically deploys an endpoint with swaggerui to play with your new API directly from browser

To access you need open http://your_instance_url/api_docs/v1

Next steps

The next steps it's work in a admin panel that shows the records of the schema tables, possible triggers like webhooks and all related stuff related to the model specs and records, maybe more datatypes, a API call that not triggers hooks, possible auth for the admin panel, im planning this part so all it's possible

Summary

  • Admin panel
    • Data from tables
    • Triggers (hooks)
  • API call that no triggers hooks
  • More datatypes

Top comments (0)