diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4847798 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,5 @@ +# Contributing + +Thank you for showing an interest in contributing to Eik 🧡 + +You can find [the contribution docs here](https://github.com/eik-lib/.github/blob/main/CONTRIBUTING.md). diff --git a/README.md b/README.md index 57f291e..cd5565d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,54 @@ # @eik/core -Core server functionallity +This module holds the core server functionality of [`@eik/service`](https://github.com/eik-lib/service#readme). +Each [HTTP API endpoint](https://eik.dev/docs/server/http-api) has +its own class handling the specific path and method. + +## API + +### http + +This namespace holds the different HTTP API endpoint handlers. Each handler is a class with an async `handler` method. + +```js +import { http } from "@eik/core"; + +let pkgGetHandler = new eik.http.PkgGet({ organizations, sink, logger }); + +let response = await pkgGetHandler.handler( + request, + type, + name, + version, + extras, +); +``` + +For a more complete usage example, see +[the implementation in `@eik/service`](https://github.com/eik-lib/service/blob/00c85c1d366df50b688a82e62e5890381df11b0f/lib/main.js#L76-L113). + +### prop + +A gollection of globals holding base paths. + +```js +import { prop } from "@eik/core"; + +const { base_auth, base_map, base_pkg, base_npm } = prop; +``` + +### HealthCheck + +A health check implementation that does a create, read and delete check +against the configured [storage sink](https://eik.dev/docs/server/storage). + +```js +import { HealthCheck } from "@eik/core"; + +const health = new HealthCheck({ + logger, + sink, +}); + +await health.check(); +```