on master help sign in
LICENSEmode 100644 → 100755
since splitsnapshots
unifiedsplit

Only the mode changed.

Procfilemode 100644 → 100755

Only the mode changed.

Setup.hsmode 100644 → 100755

Only the mode changed.

app.jsonmode 100644 → 100755

Only the mode changed.

app/Main.hsmode 100644 → 100755+2−1
@@ -4,6 +4,7 @@ import Network.Wai.Handler.Warp (run)
4import Servant.Server (serve)
4import Servant.Server (serve)
5import System.Environment
5import System.Environment
6import Lib
6import Lib
7+import Network.Wai.Middleware.Cors
7
8
8main :: IO ()
9main :: IO ()
9main = do
10main = do
@@ -12,4 +13,4 @@ main = do
12 putStrLn $ "Starting on port: " ++ show port
13 putStrLn $ "Starting on port: " ++ show port
13 print env
14 print env
14 srv <- createServer
15 srv <- createServer
15− run port $ serve server srv
16+ run port $ simpleCors $ serve server srv
docs.mdmode 100644 → 100755

Only the mode changed.

docs/Docs.hsmode 100644 → 100755

Only the mode changed.

package.yamlmode 100644 → 100755+1
@@ -36,6 +36,7 @@ dependencies:
36- servant-websockets
36- servant-websockets
37- websockets
37- websockets
38- lens
38- lens
39+- wai-cors
39
40
40library:
41library:
41 source-dirs: src
42 source-dirs: src
readme.mdmode 100644 → 100755+4−2
@@ -20,7 +20,7 @@ _url: [`https://websuck1t.herokuapp.com`](https://websuck1t.herokuapp.com)_
20```javascript
20```javascript
21{
21{
22 "token": 1,
22 "token": 1,
23− "reponse": [
23+ "response": [
24 {
24 {
25 "postBody": "This is the post body",
25 "postBody": "This is the post body",
26 "postAuthor": 4,
26 "postAuthor": 4,
@@ -124,6 +124,8 @@ Retrieves a user with the given `id`.
124
124
125## WebSocket /posts/subscribe/:token
125## WebSocket /posts/subscribe/:token
126
126
127+You access the web socket with the web socket protocol. I. e. `https://` -> `ws://`.
128+
127Open a web socket from the given `token` for receiving events about new and deleted posts.
129Open a web socket from the given `token` for receiving events about new and deleted posts.
128
130
129#### Returns error `498` if the supplied token has expired or is invalid.
131#### Returns error `498` if the supplied token has expired or is invalid.
@@ -138,7 +140,7 @@ Open a web socket from the given `token` for receiving events about new and dele
138```javascript
140```javascript
139{
141{
140 "token": 1828,
142 "token": 1828,
141− "reponse": {
143+ "response": {
142 "deleted": [
144 "deleted": [
143 1819,
145 1819,
144 1835,
146 1835,
src/Data/CyclicBuffer.hsmode 100644 → 100755

Only the mode changed.

src/Data/Error.hsmode 100644 → 100755

Only the mode changed.

src/Foo/Data.hsmode 100644 → 100755+3−3
@@ -85,14 +85,14 @@ createConfig :: IO Config
85createConfig = do
85createConfig = do
86 mng <- newManager tlsManagerSettings
86 mng <- newManager tlsManagerSettings
87 cfg <- atomically $ Config <$> newTVar 0 <*> newTVar 0 <*> newTVar M.empty <*> newTVar M.empty <*> return mng <*> newTVar M.empty <*> newTVar 0 <*> newTVar (CB.empty 20)
87 cfg <- atomically $ Config <$> newTVar 0 <*> newTVar 0 <*> newTVar M.empty <*> newTVar M.empty <*> return mng <*> newTVar M.empty <*> newTVar 0 <*> newTVar (CB.empty 20)
88− forkIO . forever $ threadDelay 7000000 >> (runHandler . createApp cfg $ startAddingPosts 20 cfg >>= uncurry sendUpdate)
88+ forkIO . forever $ threadDelay 2000000 >> (runHandler . createApp cfg $ startAddingPosts 20 cfg >>= uncurry sendUpdate)
89 return cfg
89 return cfg
90
90
91type Token = Int
91type Token = Int
92
92
93data TokenizedResponse d = TokenizedResponse {
93data TokenizedResponse d = TokenizedResponse {
94 token :: Token,
94 token :: Token,
95− reponse :: d
95+ response :: d
96} deriving Generic
96} deriving Generic
97
97
98instance ToJSON d => ToJSON (TokenizedResponse d)
98instance ToJSON d => ToJSON (TokenizedResponse d)
@@ -165,7 +165,7 @@ startAddingPosts lim cfg = do
165 let us = users cfg
165 let us = users cfg
166 let ps = posts cfg
166 let ps = posts cfg
167
167
168− a <- liftIO $ loremBacon (manager cfg) (Just AllMeat) (Just lim) (Just False)
168+ a <- liftIO $ loremBacon (manager cfg) (Just AllMeat) (Just lim) (Just 0)
169 g <- liftIO newStdGen
169 g <- liftIO newStdGen
170 let rns = randoms g
170 let rns = randoms g
171
171
src/Lib.hsmode 100644 → 100755

Only the mode changed.

src/Network/Bacon.hsmode 100644 → 100755+3−3
@@ -21,15 +21,15 @@ instance ToHttpApiData LoremType where
21 toQueryParam MeatAndFiller = "meat-and-filler"
21 toQueryParam MeatAndFiller = "meat-and-filler"
22 toQueryParam AllMeat = "all-meat"
22 toQueryParam AllMeat = "all-meat"
23
23
24−type API = QueryParam "type" LoremType :> QueryParam "paras" Int :> QueryParam "start-with-lorem" Bool :> Get '[JSON] [Text]
24+type API = QueryParam "type" LoremType :> QueryParam "paras" Int :> QueryParam "start-with-lorem" Int :> Get '[JSON] [Text]
25
25
26clientAPI :: Proxy API
26clientAPI :: Proxy API
27clientAPI = Proxy
27clientAPI = Proxy
28
28
29−loremBacon' :: Maybe LoremType -> Maybe Int -> Maybe Bool -> ClientM [Text]
29+loremBacon' :: Maybe LoremType -> Maybe Int -> Maybe Int -> ClientM [Text]
30loremBacon' = client clientAPI
30loremBacon' = client clientAPI
31
31
32−loremBacon :: Manager -> Maybe LoremType -> Maybe Int -> Maybe Bool -> IO (Maybe [Text])
32+loremBacon :: Manager -> Maybe LoremType -> Maybe Int -> Maybe Int -> IO (Maybe [Text])
33loremBacon mng a b c = do
33loremBacon mng a b c = do
34 let env = mkClientEnv mng (BaseUrl Https "baconipsum.com" 443 "api")
34 let env = mkClientEnv mng (BaseUrl Https "baconipsum.com" 443 "api")
35 res <- runClientM (loremBacon' a b c) env
35 res <- runClientM (loremBacon' a b c) env
stack.yamlmode 100644 → 100755

Only the mode changed.

swagger/Swagger.hsmode 100644 → 100755

Only the mode changed.

test/Spec.hsmode 100644 → 100755

Only the mode changed.