Comparing version 0.1.0 to 0.1.1
@@ -44,6 +44,7 @@ (function (global, factory) { | ||
//. type Name = String | ||
//. type Services a = Dict Name a | ||
//. data Bootstrapper a b = Bootstrapper { | ||
//. name :: Name, | ||
//. needs :: Array Name, | ||
//. bootstrap :: Hook (Future Error a) b | ||
//. bootstrap :: Services b -> Hook (Future Error a) b | ||
//. } | ||
@@ -54,3 +55,3 @@ //. ``` | ||
//. | ||
//# bootstrap :: Array (Bootstrapper a b) -> Hook (Future Error a) (StrMap b) | ||
//# bootstrap :: Array (Bootstrapper a b) -> Hook (Future Error a) (Services b) | ||
//. | ||
@@ -57,0 +58,0 @@ //. Given a list of service bootstrappers, returns a `Hook` that represents the |
{ | ||
"name": "booture", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Application bootstrapping on top of Fluture Hooks", | ||
@@ -5,0 +5,0 @@ "main": "index", |
@@ -78,7 +78,9 @@ # Booture | ||
const withServices = runHook (bootstrap ([ bootstrapConfig, | ||
bootstrapPostgres, | ||
bootstrapRedis, | ||
bootstrapApp ])); | ||
const servicesHook = bootstrap ([ bootstrapConfig, | ||
bootstrapPostgres, | ||
bootstrapRedis, | ||
bootstrapApp ]); | ||
const withServices = runHook (servicesHook); | ||
const program = withServices (({app}) => Future ((rej, res) => { | ||
@@ -93,2 +95,11 @@ const conn = app.listen (3000); | ||
Some things to note about the example above, and general usage of Booture: | ||
1. `servicesHook` is a `Hook`, so before running it, it can be composed | ||
with other hooks using `map`, `ap`, and `chain`, and even used in the | ||
definition of other bootstrappers. | ||
2. `program` is a `Future`, so nothing happens until it's forked. Before | ||
forking it, it can be composed with other Futures using `map`, `ap`, | ||
`bimap`, and `chain`, or any of the other functions provided by Fluture. | ||
## API | ||
@@ -100,6 +111,7 @@ | ||
type Name = String | ||
type Services a = Dict Name a | ||
data Bootstrapper a b = Bootstrapper { | ||
name :: Name, | ||
needs :: Array Name, | ||
bootstrap :: Hook (Future Error a) b | ||
bootstrap :: Services b -> Hook (Future Error a) b | ||
} | ||
@@ -110,3 +122,3 @@ ``` | ||
#### <a name="bootstrap" href="https://github.com/fluture-js/booture/blob/master/index.mjs#L139">`bootstrap :: Array (Bootstrapper a b) -> Hook (Future Error a) (StrMap b)`</a> | ||
#### <a name="bootstrap" href="https://github.com/fluture-js/booture/blob/master/index.mjs#L151">`bootstrap :: Array (Bootstrapper a b) -> Hook (Future Error a) (Services b)`</a> | ||
@@ -113,0 +125,0 @@ Given a list of service bootstrappers, returns a `Hook` that represents the |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13849
216
127