Skip to content

Commit

Permalink
Adapt names in platform to clarify scope and distribution of apps
Browse files Browse the repository at this point in the history
The name 'web server' used earlier sounded more like it would be limited to a single machine or not include a database.
  • Loading branch information
Viir committed May 7, 2023
1 parent 426fc33 commit 0ae86d6
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 82 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ backend_state_type_name_from_root_elm_module =
[ ( "Without module name qualifier"
, """module Backend.Main exposing
( State
, webServerMain
, webServiceMain
)
type alias State = { field_name : Int }
webServerMain : ElmFullstack.BackendConfig State
webServerMain =
webServiceMain : ElmFullstack.BackendConfig State
webServiceMain =
{ init = ( {}, [] )
, subscriptions = subscriptions
}
Expand Down
2 changes: 1 addition & 1 deletion implement/elm-time/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ElmTime;

public class Program
{
public static string AppVersionId => "2023-05-06";
public static string AppVersionId => "2023-05-07";

private static int AdminInterfaceDefaultPort => 4000;

Expand Down
4 changes: 2 additions & 2 deletions implement/elm-time/elm-time.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>ElmTime</RootNamespace>
<AssemblyName>elm-time</AssemblyName>
<AssemblyVersion>2023.0506.0.0</AssemblyVersion>
<FileVersion>2023.0506.0.0</FileVersion>
<AssemblyVersion>2023.0507.0.0</AssemblyVersion>
<FileVersion>2023.0507.0.0</FileVersion>
<Nullable>enable</Nullable>
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Backend.Main exposing
( State
, webServerMain
, webServiceMain
)

import Backend.State
Expand All @@ -12,15 +12,15 @@ import Calculator
import CompilationInterface.GenerateJsonConverters
import Json.Decode
import Json.Encode
import Platform.WebServer
import Platform.WebService


type alias State =
Backend.State.State


webServerMain : Platform.WebServer.WebServerConfig State
webServerMain =
webServiceMain : Platform.WebService.WebServiceConfig State
webServiceMain =
{ init =
( { httpRequestCount = 0
, operationsViaHttpRequestCount = 0
Expand All @@ -32,14 +32,14 @@ webServerMain =
}


subscriptions : State -> Platform.WebServer.Subscriptions State
subscriptions : State -> Platform.WebService.Subscriptions State
subscriptions _ =
{ httpRequest = updateForHttpRequestEvent
, posixTimeIsPast = Nothing
}


updateForHttpRequestEvent : Platform.WebServer.HttpRequestEventStruct -> State -> ( State, Platform.WebServer.Commands State )
updateForHttpRequestEvent : Platform.WebService.HttpRequestEventStruct -> State -> ( State, Platform.WebService.Commands State )
updateForHttpRequestEvent httpRequestEvent stateBeforeCountHttpRequest =
let
stateBefore =
Expand Down Expand Up @@ -101,7 +101,7 @@ updateForHttpRequestEvent httpRequestEvent stateBeforeCountHttpRequest =
}
in
( state
, [ Platform.WebServer.RespondToHttpRequest httpResponse ]
, [ Platform.WebService.RespondToHttpRequest httpResponse ]
)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Backend.MigrateState exposing (migrate)

import Backend.Main
import Platform.WebServer
import Platform.WebService


migrate : Backend.Main.State -> ( Backend.Main.State, Platform.WebServer.Commands Backend.Main.State )
migrate : Backend.Main.State -> ( Backend.Main.State, Platform.WebService.Commands Backend.Main.State )
migrate state =
( state, [] )
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
module Platform.WebServer exposing (..)
module Platform.WebService exposing (..)

{-| This module contains the types describing the Elm-Time web server platform.
To build a web server app in Elm, copy this module file into your project and add a declaration with the name `webServerMain` to an Elm module.
{-| This module contains the types describing the Elm-Time web service platform.
To build a web service app in Elm, copy this module file into your project and add a declaration with the name `webServiceMain` to an Elm module.
For the latest version of the documentation, see <https://elm-time.org>
-}


{-| Use the type `WebServerConfig` on a declaration named `webServerMain` to declare a web server program in an Elm module.
A web server can subscribe to incoming HTTP requests and respond to them. It can also start and manage volatile processes to integrate other software.
{-| Use the type `WebServiceConfig` on a declaration named `webServiceMain` to declare a web service program in an Elm module.
A web service can subscribe to incoming HTTP requests and respond to them. It can also start and manage volatile processes to integrate other software.
-}
type alias WebServerConfig state =
type alias WebServiceConfig state =
{ init : ( state, Commands state )
, subscriptions : state -> Subscriptions state
}


type alias WebServerConfig state =
WebServiceConfig state


type alias Subscriptions state =
{ httpRequest : HttpRequestEventStruct -> state -> ( state, Commands state )
, posixTimeIsPast :
Expand Down

0 comments on commit 0ae86d6

Please sign in to comment.