hserv (empty) → 0.1.0.1
raw patch · 5 files changed
+131/−0 lines, 5 filesdep +basedep +cmdargsdep +wai-app-staticsetup-changed
Dependencies added: base, cmdargs, wai-app-static, warp
Files
- LICENSE +20/−0
- README.md +18/−0
- Setup.hs +2/−0
- hserv.cabal +67/−0
- src/Main.hs +24/−0
+ LICENSE view
@@ -0,0 +1,20 @@+The MIT License (MIT)++Copyright (c) 2014 Jayesh Kumar Gupta++Permission is hereby granted, free of charge, to any person obtaining a copy of+this software and associated documentation files (the "Software"), to deal in+the Software without restriction, including without limitation the rights to+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of+the Software, and to permit persons to whom the Software is furnished to do so,+subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ README.md view
@@ -0,0 +1,18 @@+hserv+=====++Simple haskell server (just like python -m http.server).++```sh+hserv [OPTIONS]++Common flags:+-p --port[=INT] Port on which server should run+-? --help Display help message+-V --version Print version information+```+For example to use port 6556, run:++```sh+hserv -p6556+```
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ hserv.cabal view
@@ -0,0 +1,67 @@+-- The name of the package.+name: hserv++-- The package version. See the Haskell package versioning policy (PVP) +-- for standards guiding when and how versions should be incremented.+-- http://www.haskell.org/haskellwiki/Package_versioning_policy+-- PVP summary: +-+------- breaking API changes+-- | | +----- non-breaking API additions+-- | | | +--- code changes with no API change+version: 0.1.0.1++-- A short (one-line) description of the package.+synopsis: Simple http server in haskell, similar to as provided by `python -m SimpleHTTPServer`.++-- A longer description of the package.+description: Simple http server in haskell, similar to as provided by `python -m SimpleHTTPServer`.++-- URL for the project homepage or repository.+homepage: github.com/rejuvyesh/hserv++-- The license under which the package is released.+license: MIT++-- The file containing the license text.+license-file: LICENSE++-- The package author(s).+author: rejuvyesh++-- An email address to which users can send suggestions, bug reports, and +-- patches.+maintainer: mail@rejuvyesh.com++-- A copyright notice.+-- copyright: ++category: Network++build-type: Simple++-- Extra files to be distributed with the package, such as examples or a +-- README.+extra-source-files: README.md++-- Constraint on the version of Cabal needed to build this package.+cabal-version: >=1.10+++executable hserv+ -- .hs or .lhs file containing the Main module.+ main-is: Main.hs+ ghc-options: -O3 -Wall -threaded+ -- Modules included in this executable, other than Main.+ -- other-modules: + + -- LANGUAGE extensions used by modules in this package.+ other-extensions: OverloadedStrings, DeriveDataTypeable+ + -- Other library packages from which modules are imported.+ build-depends: base >=4.6 && <4.7, wai-app-static >=2.0 && <3,+ warp >=2.0 && <2.1, cmdargs >=0.10 && <0.11+ + -- Directories containing source files.+ hs-source-dirs: src+ + -- Base language which the package is written in.+ default-language: Haskell2010
+ src/Main.hs view
@@ -0,0 +1,24 @@+-- File: Main.hs+-- Copyright rejuvyesh <mail@rejuvyesh.com>, 2014++{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}+module Main where++import Network.Wai.Application.Static+import Network.Wai.Handler.Warp+import System.Console.CmdArgs++data Hserv = Hserv+ { port :: Int+ }+ deriving (Data, Typeable)++main :: IO()+main = do+ hserv <- cmdArgs $ Hserv+ { port = 8888 &= help "Port on which server should run" &= opt (8888::Int) }+ &= summary "hserv 0.1"+ let p = port hserv+ putStrLn $ "Running hserv on port " ++ (show p)+ putStrLn $ "Go to http://0.0.0.0:" ++ (show p)+ run p $ staticApp $ defaultFileServerSettings "."