Corvus
Corvus is the first truly declarative server-side framework for Swift. It provides a declarative, composable syntax which makes it easy to get APIs up and running. It is based heavily on the existing work from Vapor.
Example
Below is an example of a full-featured API that manages Bank Accounts and Transactions belonging to certain users. It also showcases the ease of using authentication and setting authorization rules for specific routes.
Because Corvus is composable, it is easy to use a group of components as its own component:
How to set up
After your Swift Project, in the Package.Swift
file, you will need to add the dependencies
for Corvus
and a Fluent
database driver of your choice. Below is an example with an
SQLite
driver:
Additionally, under the application's Source
folder (by default that is Sources/App
), two setup functions need to be present:
configure.swift
, in which you can configure middlewares, databases and migrations used
in the application:
And routes.swift
, which registers the routes from the Corvus
API:
Finally the application's main.swift
file (which is usually under the path Sources/Run
) should look like this:
How to use
In general, there are two types of building blocks for a Corvus
API: Group components, which
allow users to group more groups or concrete endpoints under a common route path, or
components that provide concrete functionality, like Create
or ReadAll
. Check out the
docs and the example project to learn more!
How to contribute
Review our contribution guidelines for contribution formalities.
Sources
The logo: Made by Freepik