Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 1.1 KB

Mocking-API-Calls.md

File metadata and controls

36 lines (25 loc) · 1.1 KB

👈 Return to Overview

Mocking your API calls for Local Development

The set-middleware command links your module's custom dev middleware file to One App:

$ npm run set-middleware ../[module-name]/dev.middleware.js

This allows you to use your Parrot mocks when developing your module with One App.

The set-dev-endpoints command links your module's dev endpoints file to One App.

A dev.endpoints.js file contains all the information One App needs to configure one-app-dev-proxy (our reverse proxy and mocking server that runs during development) and can be used to set remote endpoints for your Module to use during local development.

$ npm run set-dev-endpoints ../[module-name]/dev.endpoints.js

A dev.endpoints.js file looks like:

module.exports = () => ({
  apiUrl: {
    devProxyPath: 'api',
    destination: 'https://example.com',
  },
});

☝️ Return To Top