GithubHelp home page GithubHelp logo

dev-aman / mockman Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 751 KB

MockMan is a Python(Flask) project, used to create a mock local server which front end developers can use at time when backend is being parallelly developed or delayed.

Python 100.00%

mockman's Introduction

MockMan

MockMan is a Python(Flask) project, used to create a mock local server which front end developers can use at the time when the backend is being parallelly developed or delayed.

Pre Requisites

  • Python 3.7 or higher installed.
  • pip 10.0.1 or higher.

Installation

Clone the repository, open terminal and navigate to the root directory(where the run.py is)

python3 -m venv env
source env/bin/activate
pip3 install -r requirements.txt

Usage

To add new APIs Mock follow the following steps:

  • Open Project in any text editor which you are comfortable with(VS-Code, Sublime, PyCharm, etc.)

  • Add your response Mock JSON file to mocks. <MOCK_JSON_FILE_NAME.json>

    Add MOCK_JSON_FILE_NAME.json file

  • Go to the resources directory and create a new file with an appropriate name <File_Name.py>(Can be anything except the files already present in resources).

    Add File_Name.py file

  • Copy the following code to the newly created file and replace the <CLASS_NAME> with your class name and <MOCK_JSON_FILE_NAME.json> with your file name.

    from flask_restful import Resource
    from utility.FileHandler import FileHandler
    
    class CLASS_NAME(Resource):
        def get(self):
            return FileHandler.getJSONFrom("MOCK_JSON_FILE_NAME.json")

    Add code to File_Name.py

  • Go to app.py first import the newly added api class using the following syntax.

    from resources.<File_Name> import <Class_Name>
    

    add a new route by adding the endPoint.

    api.add_resource(HomeCards, '/v1/yourEndPoint')

    Add new route in app.py

  • Run the application by running the following command.

    python3 run.py

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

mockman's People

Contributors

amanshuttl avatar aman-shuttl avatar dev-aman avatar

Stargazers

 avatar

Watchers

 avatar

mockman's Issues

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.