All Projects → michaelJustin → daraja-restful

michaelJustin / daraja-restful

Licence: AGPL-3.0 license
RESTful extension for Daraja HTTP Framework

Programming Languages

pascal
1382 projects

Projects that are alternatives of or similar to daraja-restful

ShellRemoteBot
Shell remote control from telegram (SSH/terminal emulator)
Stars: ✭ 28 (+21.74%)
Mutual labels:  freepascal
gonrails
Rails like mvc backend application with golang .
Stars: ✭ 37 (+60.87%)
Mutual labels:  restful
swagger-brake
Swagger contract checker for breaking API changes
Stars: ✭ 49 (+113.04%)
Mutual labels:  restful
rails-rest-api
A simple RoR 5 REST API demo with JWT authentication.
Stars: ✭ 25 (+8.7%)
Mutual labels:  restful
jcore
Some FPC classes and frameworks I have implemented so far
Stars: ✭ 26 (+13.04%)
Mutual labels:  freepascal
hasor
Hasor是一套基于 Java 语言的开发框架,区别于其它框架的是 Hasor 有着自己一套完整的体系,同时还可以和先有技术体系做到完美融合。它包含:IoC/Aop容器框架、Web框架、Jdbc框架、RSF分布式RPC框架、DataQL引擎,等几块。
Stars: ✭ 938 (+3978.26%)
Mutual labels:  restful
Bauglir-WebSocket-2
Copy of https://code.google.com/archive/p/bauglir-websocket/
Stars: ✭ 15 (-34.78%)
Mutual labels:  freepascal
QQWry
Delphi interface for QQWry IP database
Stars: ✭ 14 (-39.13%)
Mutual labels:  freepascal
madao
🎉 My blog, powered by @nuxt
Stars: ✭ 54 (+134.78%)
Mutual labels:  restful
aws
Object Pascal implementation for Amazon S3
Stars: ✭ 67 (+191.3%)
Mutual labels:  freepascal
flask-restx-boilerplate
🔥 REST API written in Flask micro web framework with the Flask-RESTX framework.
Stars: ✭ 132 (+473.91%)
Mutual labels:  restful
go-rest
Build golang restful api, with - Gin Framework and MongoDB
Stars: ✭ 20 (-13.04%)
Mutual labels:  restful
RS232-Monitor-Database
🔌📺 This is a public database for all the known RS232 commands for professionnal screens, monitors and projectors. Feel free to contribute !
Stars: ✭ 22 (-4.35%)
Mutual labels:  restful
router
An Fully Automatic RESTful PHP Router
Stars: ✭ 51 (+121.74%)
Mutual labels:  restful
gorest
Go RESTful API starter kit with Gin, JWT, GORM (MySQL, PostgreSQL, SQLite), Redis, Mongo, 2FA, email verification, password recovery
Stars: ✭ 135 (+486.96%)
Mutual labels:  restful
tinyspec
Simple syntax for describing REST APIs
Stars: ✭ 95 (+313.04%)
Mutual labels:  restful
edap
No description or website provided.
Stars: ✭ 22 (-4.35%)
Mutual labels:  restful
GLPT
GLPT :: OpenGL Pascal Toolkit. A multi-platform library for OpenGL and OpenGL ES
Stars: ✭ 26 (+13.04%)
Mutual labels:  freepascal
min
A decorator web framework for deno
Stars: ✭ 21 (-8.7%)
Mutual labels:  restful
HttpServerLite
TCP-based simple HTTP and HTTPS server, written in C#.
Stars: ✭ 44 (+91.3%)
Mutual labels:  restful

daraja-restful

RESTful extension for the Daraja HTTP Framework

How does it work?

Here is a short example, it registers a request handler at path hello which handles HTTP GET requests, but only if the HTTP request also specifies that the client accepts responses with content type text/html. (A HTTP error response will be returned if the HTTP client tries to submit a POST request, or if the client specifies a different content type).

   &Path('hello');
   &Produces('text/html');
   GET
    (procedure(Request: TdjRequest; Response: TdjResponse)
     begin
       Response.ContentText := '<html>Hello world!</html>';
     end);

Path Parameters

The framework supports path parameters, so that http://mydomain.local/myapp/orders/123 will be routed to this parametrized request handler:

   &Path('orders/{orderId}')
   &Produces('text/html');       
   GET
    (procedure(Request: TdjRequest; Response: TdjResponse)
     begin
       Response.ContentText :=
         Format('<html>Thank you for your order %s</html>',
           [Request.Params.Values['orderId']]);
     end);         

Multiple Resource Representations

If a resource has more than one representation (HTML, XML or JSON), this can be handled using the same Path value but different MIME type Produces attributes:

   // respond to HTML browsers
   &Path('myresource');
   &Produces('text/html');
   GET(procedure(Request: TdjRequest; Response: TdjResponse)
       begin
         Response.ContentText :=
           '<html>Hello world!</html>';
       end);
    
   // respond to XML client
   &Path('myresource');
   &Produces('application/xml');
   GET(procedure(Request: TdjRequest; Response: TdjResponse)
       begin
         Response.ContentText := '<xml>Hello world!</xml>';
         Response.CharSet := 'utf-8';
   end);
    
   // respond to JSON client
   &Path('myresource');
   &Produces('application/json');
   GET(procedure(Request: TdjRequest; Response: TdjResponse)
       begin
         Response.ContentText := '{"msg":"Hello world!"}';
         Response.CharSet := 'utf-8';
   end);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].