javascript - Getting started with Mock server and Grunt -
i've read documentation on http://www.mock-server.com/. after few hours of effort spent on following getting started still cannot mockserver working.
can please specify exact steps or point me on wrong?
gruntfile:
var configobj = { connect: { all: { options:{ port: 9000, hostname: "0.0.0.0" } } }, start_mockserver: { start: { options: { serverport: 8080, proxyport: 1090 } } }, stop_mockserver: { stop: { } } }
in index.html
<script type="text/javascript" src="https://cdn.rawgit.com/jamesdbloom/mockserver/6a2fb42cb7933d0d68e7d595785a9b0536450825/mockserver-client-javascript/src/main/javascript/mockserverclient.js"></script> <script> mockserverclient("localhost", 9000).mocksimpleresponse('/somepath', { name: 'value' }, 203); </script>
i don't understand how mockserver , grunt connect work togeter on different ports
the error receive in browser on 9000 put http://localhost:9000/expectation 405 (method not allowed)
i going through same difficulties. believe mockserver 1 of worst when comes documentation. go , explain many new concepts without telling in file configurations should placed. have yet see configuration file name in documentation. investigating because need use project. report here if find useful. using nodejs concept should same.
edit:
i have discovered need setup mock-server expectation part of request using mockserver-client. send server specs describing way want respond you, call server in way match expectation have submitted, etc.
unfortunately didn't worked me. started getting errors couldn't find explanation in documentation. that's when have decided find alternative.
the alternative found far more simple , flexible mock-server. it's called canned. works mapping folder structure incoming request. if specific file found in matching folder, content used produce response , extension dictate content type. give try. might love it. it's @ https://www.npmjs.com/package/canned
i hope help.
Comments
Post a Comment