Wrapscan Registry is a package registry for wraps
(composable wasm modules).
The primary function of the registry is to facilitate the publishing of URIs, acting as the go-to source from where these wraps can be downloaded.
GET /
- Home: get version of the registryGET /r/{user}/{package_and_version}
- Get the latest version of the wrap- Returns:
- Body
{ name: "0.1.0", uri: "wrap://...", ... }
- Body
- Returns:
GET /v/{user}/{package}
- Get package info- Returns:
- Body
{ id: "user_name/package_name", name: "package_name", ... }
- Body
- Returns:
GET /r/{user}/{package_and_version}/wrap.info
- Get the published URI for the wrap- Returns:
- Header
x-wrap-uri: wrap://...
- Status: 200
- Header
- Returns:
POST /r/{user}/{package_and_version}
- Publish a URI for the wrap- Header:
Authorization: Bearer {base64 encoded API key}
- Body:
{ uri: "wrap://..." }
- Header:
- nvm use
yarn db
to start the dbyarn dev
to start the serveryarn test
to run the tests
You can also use the cargo commands directly in the gateway_service crate:
cargo run -F local
to start the servercargo test
to run the tests
All of the yarn commands run both for the feature flag local
and without it.
We use #[cfg(feature = "local")]
to switch between local and production code.
To run locally the feature flag local
must be set. This will use a local database and server.
To get your editor working with the local flag, temporarily edit Cargo.toml and add the following:
[features]
default = ["local"]
rust/gateway_service
contains the gateway service crate
src/main.rs
is the entrypoint for the serversrc/setup_routes
contains the server initialization and route registrationsrc/routes
contains the route handlerssrc/functions
contains the raw functions the service supports (1:1 mapping to routes)src/constants
contains constants used throughout the servicesrc/models
contains the models used throughout the service
src/db
contains the database codesrc/db/local_db.rs
contains setup for the local database, it only runs when thelocal
feature flag is setsrc/db/dynamodb.rs
contains DynamoDbClient and PackageRepository implementations for the production database
src/debugging.rs
contains debugging utilities- To help with debugging locally, two macros are available (note they only work when the
local
feature flag is set):debug!
- is a wrapper arounddbg!
.- It prints the file and line number of the debug statement as well as the value of the expression passed.
debug_println!
- prints to stdout