Skip to content
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

Is there a plan to support server side mocking? #238

Open
jackjocross opened this issue Apr 4, 2017 · 7 comments
Open

Is there a plan to support server side mocking? #238

jackjocross opened this issue Apr 4, 2017 · 7 comments

Comments

@jackjocross
Copy link

I came across Mimic while looking for a mocking tool for local development and it looks awesome!

My only issue is my application uses SSR so I would also need to mock the requests made from the server. I see that Mimic is described as "client side mocking" but I was wondering if there is any way to do this currently or if there are plans to support SSR in the future?

@morsdyce
Copy link
Owner

morsdyce commented Apr 5, 2017 via email

@jackjocross
Copy link
Author

Are you looking for contributors? This is a use case I would love to help out with.

@morsdyce
Copy link
Owner

morsdyce commented Apr 6, 2017 via email

@jackjocross
Copy link
Author

Cool! I think remote mode sounds like a good place to start. I'm planning on digging into this more over the weekend so should have a better understanding then.

@morsdyce morsdyce removed this from In Progress in v2.0.3 Aug 11, 2017
@morsdyce
Copy link
Owner

morsdyce commented Jun 4, 2018

Just an update on this, the latest releases of mimic expose a custom interceptor system where you could implement your own interceptor, so this is now possible to implement.

@danrevah
Copy link

@morsdyce No you can't really do that.. bootstrapUI & other functions will throw errors.. unless there's a way to register a custom interceptor before load that I'm missing?

@morsdyce
Copy link
Owner

hey @danrevah
It's possible to load mimic without any UI at all using only strictly the API layer.
For example we have mimic/remote which communicates requests via web sockets to an external UI client run separately (via a separate package called mimic-remote).

In addition to that you do have the ability to create a custom interceptor to capture request in any manner you'd want. This isn't documented very well currently but you can see how to register it here:
https://github.com/500tech/mimic/blob/master/lib/api/index.js#L29

and an example of what an interceptor usually contains here:
https://github.com/500tech/mimic/blob/master/lib/api/interceptors/web-interceptor.js

As long as you keep the same interface it should work.
If you're interested in helping with this I'd love to talk more and explain how everything works. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants