simple_app_api

Unified Application Layer for Eiffel Projects

Application Layer v1.0.0 MIT

Overview

simple_app_api is the top-level unified facade for Eiffel applications. One class gives you access to the entire simple_* ecosystem through inheritance: APP inherits SERVICE inherits FOUNDATION.

What You Get

HTTP Client

GET, POST, PUT, DELETE requests with fluent API

Alpine.js

Generate reactive UI components in Eiffel

JWT Auth

Create and verify tokens (inherited)

SQL Database

SQLite with query builder (inherited)

SMTP Email

Send emails with TLS (inherited)

Rate Limiting

Protect APIs (inherited)

Base64/Hash

Encoding, MD5, SHA (inherited)

JSON/CSV

Parse and generate (inherited)

UUID

Generate unique IDs (inherited)

Installation

One library to rule them all:

<library name="simple_app_api"
        location="$SIMPLE_APP_API\simple_app_api.ecf"/>

Quick Start

local
    app: APP
do
    create app.make

    -- HTTP requests
    response := app.web_client.get ("https://api.example.com")

    -- Alpine.js UI
    div := app.alpine.div
    div.x_data ("{count: 0}")

    -- JWT (inherited from SERVICE)
    token := app.create_token ("secret", "user", "app", 3600)

    -- Database (inherited from SERVICE)
    db := app.new_memory_database

    -- Hashing (inherited from FOUNDATION)
    hash := app.sha256 ("password")
end

API Reference

Application Layer (APP)

web_client: SIMPLE_WEB_CLIENT
new_web_client: SIMPLE_WEB_CLIENT
new_get_request (url): SIMPLE_WEB_REQUEST
new_post_request (url): SIMPLE_WEB_REQUEST
alpine: ALPINE_FACTORY
new_alpine_factory: ALPINE_FACTORY

Service Layer (inherited)

create_token (secret, subject, issuer, expires): STRING
verify_token (secret, token): BOOLEAN
new_database (path): SIMPLE_SQL
new_memory_database: SIMPLE_SQL
new_smtp (host, port): SIMPLE_SMTP
new_cors: SIMPLE_CORS
new_rate_limiter (max, window): SIMPLE_RATE_LIMITER
render_template (template, data): STRING

Foundation Layer (inherited)

base64_encode (data): STRING
base64_decode (data): STRING
md5 (data): STRING
sha256 (data): STRING
new_uuid: STRING
parse_json (text): SIMPLE_JSON_VALUE
parse_csv (text): LIST [LIST [STRING]]

Bundled Libraries

Library Purpose
simple_webHTTP client
simple_alpineAlpine.js components
simple_service_apiService layer (inherited)
simple_foundation_apiFoundation (inherited)