-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: JavaScript API for the ability to run mocker on existing server endpoint #610
Comments
Awesome proposal !!!! 👍 |
Hi @bbyars. What do you say? |
I'm comfortable with the suggestion. It's close to being possible now (look
at the commented out lines starting at line 39
<https://github.com/bbyars/mountebank/blob/master/mbTest/perf/databaseConcurrencyTest.js>).
It might involve moving some CLI option defaults from the current cli.js
into mountebank.js to avoid having to pass defaults that mountebank expects
(as shown in the link), adding an option to adjust the root path, and
avoiding the socket bind, but looks reasonably straightforward.
…On Wed, Apr 21, 2021 at 5:56 AM v.chuchkalov ***@***.***> wrote:
Hi @bbyars <https://github.com/bbyars>. What do you say?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#610 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAARFPYY6QHIKPEM6ZU7GQLTJ2VMRANCNFSM43GFBODQ>
.
|
Thank you for the recommendations! Will start working on this soon) |
@bbyars , hi! Create PR, but not sure about all changes:
Will waiting review) |
Need to create some |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivation
Current JS / CLI
mountebank
API immediately create and start new http server.It means, if we want to test one NodeJS micro-service, we need to create and deploy two containers - one with our service, and one with
mountebank
.If we have a k8s infrastructure, many applications, and dynamic deployed stands with automated testing, just one additional container with
mountebank
for every application complicates deployment and take many k8s resources.But what if we can create
mountebank
instance on existing NodeJS application, at new endpoint?Our micro-service can on demand run integration with
mountebank
, where we create newexpress
endpoint,/mountebank
for example, and passreq
andres
objects to specialmountebank
JS API.After, this micro-service can replace http requests base URL to mocked API to
http://localhost:3000/mountebank
.For SSR NodeJS applications, on client-side, will be available a relative URL
/mountebank
(nuances with a gateway proxy are possible).API overview
Few examples, how new API may looks like
Nested express.js routers
Inspired by this reciepe
express.js middeware
express.js application
Example for clean
http
NodeJS serverImplementation
If this feature is discussible, and don't break some
mountebank
core concepts, i can start from a simple demo branch, for this proposal.The text was updated successfully, but these errors were encountered: