Giter Club home page Giter Club logo

mockzilla's Introduction

Mockzilla

Deployment

What is Mockzilla?

A solution for running and configuring a local HTTP server to mimic REST API endpoints used by your iOS, Android or KMM application.

The source code is written in Kotlin but is fully compatible with a Swift environment too!

Advantages

✅ Compile safe mock endpoint definitions.

✅ HTTP client agnostic.

✅ Works completely offline

✅ Entirely self-contained in your application's codebase.

Quick Start 🚀

Please see our quick start guide and full documentation here.

Why's it useful? 🙌

Development servers go down, endpoints can be late being delivered or not exist at all! Mockzilla aims to easily provide a way of simulating your server from within your mobile application's codebase.

Why not use a hosted solution? ☁️

Hosted mocking solutions can be powerful mocking tools in many cases. They have their downsides:

  1. They can go down, Mockzilla works offline!
  2. There's no compile-time checking
  3. They require active maintenance with no compile-time safety if APIs change.

What makes it compile safe? 🖥️

By defining your mocks using the same model classes as are used for deserialization, changing them, means changing the mocks or we get compiler errors! 😎

Example using kotlinx.serialization:

Existing networking models

@Serializable
data class HelloWorldResponse(val greeting: String)

Mocking code

val myEndpoint = EndpointConfiguration.Builder("hello-world")
    .setPatternMatcher { uri.endsWith("hello-world") }
    .setDefaultHandler {
        MockzillaHttpResponse(
            body = Json.encodeToString(
                // Using existing models
                HelloWorldResponse(greeting = "Hello world!")
            )
        )
    }

Important Note 🛑

Mockzilla is designed as a development and test tool only.

Mockzilla should never be used in production. Its traffic is unprotected and by nature of running a server on device, it can introduce security issues.

Do not ship it to production.

mockzilla's People

Contributors

samc-apadmi avatar tomrhandcock avatar jordanh-apadmi avatar samcosta1 avatar skeletonxf avatar chedabob avatar dependabot[bot] avatar mattmapadmi avatar github-actions[bot] avatar jordanllharper avatar rebeccal-apadmi avatar gamirou avatar patrickcapadmi avatar todorovik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.