Skip to content

Move more server logic to endpoints #110

Open
@joepio

Description

@joepio

atomic-server has a couple of endpoints that provide a bunch of features:

These tend to return kind of inconsistent responses. Validate only returns an HTML page, and none of them even return atomic resources consistently. For handling collections, sorting and pagination #17 and versioning #42, I've been using Extended Resources - which basically means that (some of) their values are dynamic; they are calculated at runtime. I think this would be a powerful abstraction for the plugin system #73.

So... What are Endpoints?

Let the struct speak for itself:

/// An API endpoint at some path which accepts requests and returns some Resource.
pub struct Endpoint {
  /// The part behind the server domain, e.g. '/versions' or '/collections'. Include the slash.
  pub path: String,
  /// The function that is called when the request matches the path
  pub handle: fn(subject: url::Url, store: &Db) -> AtomicResult<Resource>,
  /// The list of properties that can be passed to the Endpoint as Query parameters
  pub params: Vec<String>,
  pub description: String,
  pub shortname: String,
}

So next up is creating these Endpoints for existing handler on the server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lib rustatomic-lib (rust)pluginShould probably be an Atomic Pluginserveratomic-server

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions