Stateful text, JSON and byte service
ASPL 0.7.0 · Current release
Native only. Stateful text, JSON and byte service, with exact supplied sources, requirements, commands and outcomes.
On this page
Prepare the native host
Listen on 127.0.0.1:8080; run the client in another terminal. /count reads then increments state. POST /stop drains the service. /upstream additionally needs server.pem and a verified HTTPS peer at localhost:9443/hello.
Follow the deployment guide for certificates, CA selection, working directories and the complete upstream workflow.
Follow the HTTP guide and API reference. Keep the original filenames and the modules of the selected source variant. Save Arabic and English variants in separate directories. TLS inputs are supplied by the reader, with no bundled certificates or keys. No other data assets are required.
Arabic source
Execution: Native only · ASPL 0.7.0
- Native only. Published ASPL 0.7.0 on x86-64 Linux with glibc 2.34 or later. No input lines. Listen on 127.0.0.1:8080; run the client in another terminal. /count reads then increments state. POST /stop drains the service. /upstream additionally needs server.pem and a verified HTTPS peer at localhost:9443/hello.
Input: No input lines are required.
Arabic source · Required source modules, keep each variant in a separate directory:
استورد أساسي::ويب.
استورد إعدادات.لبات بسم تطبيق.
استورد معالجات.لبات بسم معالجات.
دالة ابدأ_الرئيسية() -> ص64 {
دع نتيجة_الحساب = ويب::اخدم(تطبيق::خادم(خطأ), معالجات::وجهات(),
تطبيق::إعدادات { خادم_بعيد: "https://localhost:9443/hello", مرجع: "server.pem" },
تطبيق::حالة { عدد: 0 }).
إذا ليس نتيجة_الحساب::نجاح { اطبع(نتيجة_الحساب::الخطأ::الرمز). أرجع 1. }
أرجع 0.
}
Follow the Linux instructions to run this example. Download the source to keep a copy.
Download خدمة.لباتExpected outcomes
{
"native": {
"check": 0,
"status": 0,
"output": ""
}
}English source
Execution: Native only · ASPL 0.7.0
- Native only. Published ASPL 0.7.0 on x86-64 Linux with glibc 2.34 or later. No input lines. Listen on 127.0.0.1:8080; run the client in another terminal. /count reads then increments state. POST /stop drains the service. /upstream additionally needs server.pem and a verified HTTPS peer at localhost:9443/hello.
Input: No input lines are required.
English source · Required source modules, keep each variant in a separate directory:
import core::http;
import settings.aspl as app;
import handlers.aspl as handlers;
fn start_main() -> i64 {
let result = http::serve(app::server(false), handlers::routes(),
app::Config { upstream: "https://localhost:9443/hello", ca: "server.pem" },
app::State { count: 0 });
if not result::ok { print(result::error::code); return 1; }
return 0;
}
Follow the Linux instructions to run this example. Download the source to keep a copy.
Download service.asplExpected outcomes
{
"native": {
"check": 0,
"status": 0,
"output": ""
}
}Commands and outcomes
ar:
aspl check ar/service.لبات
aspl run ar/service.لبات
aspl build -o http-service-ar-program ar/service.لبات
./http-service-ar-programen:
aspl check en/service.aspl
aspl run en/service.aspl
aspl build -o http-service-en-program en/service.aspl
./http-service-en-programRun these commands from the parent of the separate ar/en source directories. The service stays in the foreground until POST /stop, then exits with 0 and no output. Start its matching client separately. Expected outcome details above come from the catalog. See the HTTP collection.