diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,3 +1,8 @@
+## 0.1.2
+
+* Add pretty print for mock-handler
+* Add mock-server function
+
 ## 0.1.1
 
 * Fix README
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -6,6 +6,8 @@
 - Verify RAML format
 - Convert RAML to HTML
 - Convert RAML to Yesod-Route file
+- Generate mock-handler code
+- Run mock server
 
 
 ## Usage
@@ -26,4 +28,16 @@
 
 ```
 > yesod-raml-bin toroute "raml file" "routes file"
+```
+
+Generate mock-handler code
+
+```
+> yesod-raml-bin tomock "raml file" "haskell mock code"
+```
+
+Run mock-server
+
+```
+> yesod-raml-bin mock-server -p "port(default: 3000)" "raml file"
 ```
diff --git a/main.hs b/main.hs
--- a/main.hs
+++ b/main.hs
@@ -1,16 +1,31 @@
+{-# LANGUAGE OverloadedStrings #-}
+
 import Yesod.Raml.Type
 import Yesod.Raml.Routes
 import Yesod.Raml.Docs
+import Yesod.Raml.Mock
 import qualified Data.Yaml as Y
+import qualified Data.Text as TS
+import qualified Data.Text.Encoding as TS
 import qualified Data.Text.Lazy as T
 import qualified Data.Text.Lazy.IO as T
+import qualified Data.ByteString.Char8 as BC
+import qualified Data.ByteString.Lazy as BL
 import Text.Blaze.Html.Renderer.Text
-
 import Options.Applicative
 
+import Yesod.Routes.TH.Types
+import Network.Wai
+import Network.Wai.Handler.Warp
+import Network.HTTP.Types.Status
+import Network.HTTP.Types.Header
+import Data.Maybe
+
 data Command =
     ToRoute FilePath FilePath
   | ToHtml FilePath FilePath
+  | ToMock FilePath FilePath
+  | MockServer Port FilePath
   | Verify FilePath
 
 toroute :: Parser Command
@@ -23,10 +38,25 @@
          <$> (argument str (metavar "RamlFile"))
          <*> (argument str (metavar "HtmlFile"))
 
+tomock :: Parser Command
+tomock = ToMock
+         <$> (argument str (metavar "RamlFile"))
+         <*> (argument str (metavar "MockFile"))
+
+mockServer :: Parser Command
+mockServer = MockServer
+         <$> option auto (long "port"
+                          <> short 'p'
+                          <> value 3000
+                          <> metavar "port")
+         <*> (argument str (metavar "RamlFile"))
+
 parse :: Parser Command
 parse = subparser $ 
         command "toroute" (info toroute (progDesc "convert raml-file to route-file")) <>
         command "tohtml" (info tohtml (progDesc "convert raml-file to html-file")) <>
+        command "tomock" (info tomock (progDesc "convert raml-file to mock-file")) <>
+        command "mock-server" (info mockServer (progDesc "run mock-server")) <>
         command "verify" (info verify (progDesc "verify raml-file"))
 
 verify :: Parser Command
@@ -49,10 +79,45 @@
     Left e -> print (show e)
     Right raml' -> T.writeFile ofile (renderHtml (htmlFromRaml raml'))
 
+runCmd (ToMock ifile ofile) = do
+  v <- Y.decodeFileEither ifile :: IO (Either Y.ParseException Raml)
+  case v of
+    Left e -> print (show e)
+    Right raml' ->  do
+      mockSrcFromRaml raml' >>= writeFile ofile
+
 runCmd (Verify file) = do
   v <- Y.decodeFileEither file :: IO (Either Y.ParseException Raml)
   print v
       
+runCmd (MockServer port ifile) = do
+  v <- Y.decodeFileEither ifile :: IO (Either Y.ParseException Raml)
+  case v of
+    Left e -> print (show e)
+    Right raml' ->  do
+      case routesFromRaml raml' of
+        Left e' ->  print (show e')
+        Right routes ->  run port (app routes)
+
+comparePath ::  [Piece String] ->  [TS.Text] ->  Bool
+comparePath [] [] = True
+comparePath [] (_:_) = False
+comparePath (_:_)  [] = False
+comparePath (Static str:xs) (str':xs') = if (TS.pack str) == str' then comparePath xs xs' else False
+comparePath (Dynamic _:xs)  (_:xs') = comparePath xs xs'
+
+
+app ::  [RouteEx] ->  Application
+app routes req respond = do
+  let method = requestMethod req
+      paths = pathInfo req
+      mexample = do
+        r <-  listToMaybe $ filter (\r ->  comparePath (re_pieces r) paths)  $ routes
+        methodex <-  listToMaybe $ filter  (\m ->  me_method m ==  BC.unpack method ) $ re_methods r
+        me_example methodex
+  case mexample of
+    Nothing ->  respond $ responseLBS status400 [] ""
+    Just (ctype,val) ->  respond $ responseLBS status200 [(hContentType,TS.encodeUtf8 ctype)] $ BL.fromStrict $ TS.encodeUtf8 val
 
 opts :: ParserInfo Command
 opts = info (parse <**> helper) idm
diff --git a/yesod-raml-bin.cabal b/yesod-raml-bin.cabal
--- a/yesod-raml-bin.cabal
+++ b/yesod-raml-bin.cabal
@@ -1,5 +1,5 @@
 name:                yesod-raml-bin
-version:             0.1.1
+version:             0.1.2
 synopsis:            The raml helper executable.
 description:         Provides html documentation and route file generator
 license:             MIT
@@ -26,7 +26,10 @@
   build-depends:       base ==4.*
                      , yesod-raml == 0.2.*
                      , yesod-raml-docs == 0.1.*
+                     , yesod-raml-mock == 0.1.*
                      , yesod-markdown
+                     , yesod-core
+                     , http-types
                      , shakespeare
                      , blaze-markup
                      , blaze-html
@@ -36,5 +39,7 @@
                      , yaml
                      , bytestring
                      , template-haskell
+                     , warp
+                     , wai
   default-language:    Haskell2010
   ghc-options:       -Wall
