The Directive
The Directive is a declarative file that allows you to describe your application's business logic. By describing your application declaratively, you can avoid all of the boilerplate code that normally comes with building a web service such as binding to ports, setting up TLS, constructing a router, etc.
Here's an example Directive:
1
identifier: com.suborbital.guide
2
appVersion: v0.0.1
3
atmoVersion: v0.3.2
4
5
handlers:
6
- type: request
7
resource: /hello
8
method: POST
9
steps:
10
- group:
11
- fn: modify-url
12
- fn: helloworld-rs
13
onErr:
14
any: continue
15
16
- fn: fetch
17
18
- type: request
19
resource: /set/:key
20
method: POST
21
steps:
22
- fn: cache-set
23
24
- type: request
25
resource: /get/:key
26
method: GET
27
steps:
28
- fn: cache-get
Copied!
This directive encapsulates all of the logic for your application. It describes three endpoints and the logic needed to handle them. Each handler describes a set of steps that composes a series of Runnables to handle the request.
Atmo uses the Directive to build your application and run it automatically, without any need to write boilerplate yourself.
Last modified 1mo ago
Export as PDF
Copy link