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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-rest-mock-0.1.8.tar.gz
.
File metadata
- Download URL: django-rest-mock-0.1.8.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c95273c8eea62f7a104a14de9779c49a172dd0fcb055de4d28f3086da2910f1d |
|
MD5 | 3f7d0234a10737440ba3e4ce478d6cb0 |
|
BLAKE2b-256 | 101a4c8c3f834169a770ff6b245a5a39848c961b90918ec056110ed284b78ec2 |