Skip to main content

Mock Express server generated based on your views, that can come in handy when developing REST APIs with Django

Project description

Django REST Mock

Mock Express server generated based on your views, that can come in handy when developing REST APIs with Django.

Requirements

Requires Django 1.11 or later and Node.js.

Installation

Using pip:

$ pip install django-rest-mock

Usage

Generates an ExpressJS file:

$ python manage.py genmockserver

Starts an ExpressJS server (it will generate an ExpressJS file if necessary):

$ python manage.py startmockserver [--file]

–file (Optional): Specifies ExpressJS file to be used

Example

Let’s say you have an app with the following views.py, you will need to include the following syntax in your docstrings:

class SomeView(APIView):
    """
    URL: /some-view/
    """

    def get(self, request, *args, **kwargs):
        """
        ```
        {
            "data": "Hello, world!"
        }
        ```
        """
        pass

And then you run python manage.py genmockserver, you will get an index.js generated in your current directory

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-rest-mock-0.1.9.tar.gz (5.4 kB view details)

Uploaded Source

File details

Details for the file django-rest-mock-0.1.9.tar.gz.

File metadata

File hashes

Hashes for django-rest-mock-0.1.9.tar.gz
Algorithm Hash digest
SHA256 cc9dd6f61a7a48f633f9f20e272122b98c4c485262c64d0dabc7a28866d5c7a6
MD5 10302e1c77906e188132088df1091790
BLAKE2b-256 3989ad331d6ab9b875cfe5cd050b0ff87920ca331a0ac3c4116933204fbec27e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page