0.2.0 • Published 5 years ago

transformium v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Transformium

NPM version GitHub issues Travis

Transformium is a simple API proxy server implemented using Express. API proxy configuration can be applied immediately on the running server without restarting.

Overview

Transformium quickly create the necessary APIs or mocking data, or modify the API response data received from the back-end server without modifying the server code directly.

Installation

The easiest way to install transformium is with npm.

$ npm install transformium -g

Alternately, download the source.

$ git clone https://github.com/stegano/transformium.git

Commands

Run the server using the command below.

$ tf --port 3000 --api-config-path "<apiConfigs path to use>"

Then open a browser and access http://localhost:3000/api/test to see if the server is running properly.

ApiConfigLoaders

ApiConfigLoader is a loader that reflects proxy configuration information to the server.

  • You can create a ApiConfigLoader by implementing the module as follows.
    • You can use the setApiConfig and unsetApiConfig functions, which are passed as arguments, to immediately reflect the API setting information from the loader to the server.
function ApiConfigCustomLoader(options, setApiConfig, unsetApiConfig) {
  // ...
}

You can load it from transformium.config.js as shown below.

apiConfigLoaders: [
  {
    options: {
      ...
    },
    module: require("ApiConfigCustomLoader")
  }
]

Why Transformium?

Transformium does not require you to restart server when adding APIs or modifying response results. You can generate the API by modifying the apiConfig file and implementing the handler function, or you can modify the API response of the existing back-end server. The handler function running on the Transformium server is designed to be inaccessible to the Node API in the handler function because it is executed in the sandbox using safe-eval. Therefore, APIConfig configuration information can be safely processed even if the user inputs it.

Contributors

This project exists thanks to all the people who contribute.