Git Product home page Git Product logo

rest-api-mock-archetype's Introduction

{{package_name}}

{{package_description}}

It is built on top of Express.js which runs on Node.js.

It reads the {{package_rest_api_module_name}} module, and provides a simple express server, which echoes the mock data defined under the services.

You can modify and extend this code as you like to fit your needs. The api.js contains the implementation functions of the REST API calls which are referred from the service.yml descriptor files.

Prerequisites

In order to run the server, you need to have the Node.js and npm installed on your machine.

Installation

Clone the {{package_github_account}}/{{package_name}} server into a folder:

clone [email protected]:{{package_github_account}}/{{package_name}}.git

Install the required dependencies:

cd {{package_name}}
npm install

Usage

Start the server

To start the server, execute the following command in the server folder:

Start the mock server:

node server/server.js

register service GET /monitoring/isAlive
/monitoring/isAlive
register service GET /rtc
/rtc
...

Express server listening on port 3007 in development mode

Check if the server is properly working via executing the following command in a separate console or opening the link with a browser:

$ curl http://localhost:3007/rest/monitoring/isAlive
true

Server configuration

The server/config.yml file contains the configuration parameters for the server.

You can define many parameters, including:

  • The folder of the web content for the UI
  • The proxy for the final version of implemented backend services
  • etc.

You can group these setting into so called modes, that you can select when you start the server. To change the configuration, edit this server/config.yml file, and restart the server.

You also can add mock implementation logic, in case the built-in and dumb mock data responses are not enough for testing and frontend development. You can find example for this in the server/monitoring.js file.

To learn more about the server and its configuration, or how to extend the mock functionality with custom code visit the rest-tool homepage of the project, or go directly to the mock server documentation pages.

todos

  • Add test
    • Test each endpoint/method/testCase.

References

rest-api-mock-archetype's People

Contributors

tombenke avatar

Stargazers

 avatar

Watchers

 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.