Update docs.

This commit is contained in:
Dillon Kearns 2021-12-23 09:17:34 -08:00
parent 42f38cbe39
commit ed402465fa
3 changed files with 21 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,8 @@
module ApiRoute exposing module ApiRoute exposing
( ApiRoute, ApiRouteBuilder, Response, buildTimeRoutes, capture, int, literal, single, slash, succeed, getBuildTimeRoutes ( ApiRoute, ApiRouteBuilder, Response
, prerenderWithFallback, serverless, toJson , capture, int, literal, single, slash, succeed
, buildTimeRoutes, getBuildTimeRoutes, prerenderWithFallback, serverless
, toJson
) )
{-| ApiRoute's are defined in `src/Api.elm` and are a way to generate files, like RSS feeds, sitemaps, or any text-based file that you output with an Elm function! You get access {-| ApiRoute's are defined in `src/Api.elm` and are a way to generate files, like RSS feeds, sitemaps, or any text-based file that you output with an Elm function! You get access
@ -10,7 +12,16 @@ the DataSource for your ApiRoutes, and it won't effect the payload size. Instead
In a future release, ApiRoutes may be able to run at request-time in a serverless function, allowing you to use pure Elm code to create dynamic APIs, and even pulling in data from In a future release, ApiRoutes may be able to run at request-time in a serverless function, allowing you to use pure Elm code to create dynamic APIs, and even pulling in data from
DataSources dynamically. DataSources dynamically.
@docs ApiRoute, ApiRouteBuilder, Response, buildTimeRoutes, capture, int, literal, single, slash, succeed, getBuildTimeRoutes @docs ApiRoute, ApiRouteBuilder, Response
@docs capture, int, literal, single, slash, succeed
@docs buildTimeRoutes, getBuildTimeRoutes, prerenderWithFallback, serverless
## Internals
@docs toJson
-} -}
@ -61,6 +72,7 @@ stripTrailingSlash path =
path path
{-| -}
serverless : ApiRouteBuilder (ServerRequest.IsAvailable -> DataSource ServerResponse) constructor -> ApiRoute Response serverless : ApiRouteBuilder (ServerRequest.IsAvailable -> DataSource ServerResponse) constructor -> ApiRoute Response
serverless ((ApiRouteBuilder patterns pattern _ toString constructor) as fullHandler) = serverless ((ApiRouteBuilder patterns pattern _ toString constructor) as fullHandler) =
ApiRoute ApiRoute
@ -227,6 +239,8 @@ succeed a =
ApiRouteBuilder Pattern.empty "" (\_ -> a) (\_ -> "") (\list -> list) ApiRouteBuilder Pattern.empty "" (\_ -> a) (\_ -> "") (\list -> list)
{-| Turn the route into a pattern in JSON format. For internal uses.
-}
toJson : ApiRoute response -> Json.Encode.Value toJson : ApiRoute response -> Json.Encode.Value
toJson ((ApiRoute { kind }) as apiRoute) = toJson ((ApiRoute { kind }) as apiRoute) =
Json.Encode.object Json.Encode.object

View File

@ -1,14 +1,13 @@
module DataSource.ServerRequest exposing module DataSource.ServerRequest exposing
( IsAvailable ( IsAvailable
, ServerRequest, expectHeader, init, optionalHeader, staticData, toDataSource , ServerRequest, expectHeader, init, optionalHeader, staticData, toDataSource, withFormData, withCookies, withBody, withHost, withAllHeaders, withMethod, withProtocol, Method(..), withQueryParams
, Method(..), withAllHeaders, withBody, withCookies, withFormData, withHost, withMethod, withProtocol, withQueryParams
) )
{-| {-|
@docs IsAvailable @docs IsAvailable
@docs ServerRequest, expectHeader, init, optionalHeader, staticData, toDataSource @docs ServerRequest, expectHeader, init, optionalHeader, staticData, toDataSource, withFormData, withCookies, withBody, withHost, withAllHeaders, withMethod, withProtocol, Method, withQueryParams
-} -}
@ -203,6 +202,7 @@ withFormData (ServerRequest decoder) =
|> ServerRequest |> ServerRequest
{-| -}
type Method type Method
= Connect = Connect
| Delete | Delete