Skip to content

Commit

Permalink
添加runServerAt。
Browse files Browse the repository at this point in the history
  • Loading branch information
kalxd committed Sep 16, 2021
1 parent 922a216 commit beb424d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/Yue/Server.purs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
module Yue.Server ( ActionM
, module S
module Yue.Server ( module S
, module R
, module E
, module Aff
) where

import Yue.Internal.Type.Error (AppError)

import Effect.Aff (Aff) as Aff
import Effect.Aff.Class (class MonadAff, liftAff) as Aff
import Yue.Internal.Type.Action (ActionT) as E
Expand All @@ -18,8 +15,5 @@ import Yue.Server.Header (header, header', setCode, setHeader, setJsonHeader, tr
import Yue.Server.Param (tryParam, param, param') as E
import Yue.Server.Query (query, query', queryList, queryList', tryQuery, tryQueryList) as E
import Yue.Server.Router (delete, get, notFound, patch, post, put, route) as R
import Yue.Server.Run (runServer) as S
import Yue.Server.Run (runServer, runServerAt) as S
import Yue.Server.Option (ServerOption) as S

-- | 一个简单的别名,也许没什么用处。
type ActionM e = E.ActionT (AppError e) Aff.Aff
10 changes: 10 additions & 0 deletions src/Yue/Server/Run.purs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module Yue.Server.Run ( runServer
, runServerAt
) where

import Prelude
Expand Down Expand Up @@ -63,3 +64,12 @@ runServer { addr, port } action callback = do
, hostname: addr
, port
}

runServerAt :: forall e. IsResponseError e
=> Int
-> ActionT e Aff Unit
-> Effect Unit
-> Effect Unit
runServerAt port = runServer { addr: "127.0.0.1"
, port
}

0 comments on commit beb424d

Please sign in to comment.