The Acore Language
Introspecting Backend Objects
Accessing Models and Routes as first-class citizens.
Acore allows you to treat your backend code as data. You use the Models and Routes objects to apply configurations.
Aliasing for Convenience
To keep your configuration clean, it is a best practice to alias your models and routes using the local keyword:
amends "axiom-python:./main.py:app"
local User = Models.User
local GetUser = Routes.get_user_by_idMapping Behavior
To apply a policy to a route or model, you use the object as a key in the endpoints or models mapping:
endpoints {
[GetUser] {
// Behavior goes here
validate = true
}
}
models {
[User._model] {
fields {
[User.email] {
// Validation goes here
}
}
}
}Note the use of square brackets [...]. This is PKL syntax for using an object reference as a key in a mapping.