Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mocks-server/plugin-admin-api

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mocks-server/plugin-admin-api

Mocks Server plugin providing a REST API for administration

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22K
decreased by-31.33%
Maintainers
1
Weekly downloads
 
Created
Source

Mocks Server logo

Build Status Coverage Quality Gate Downloads Renovate License


Mocks Server Plugin Admin Api

Plugin for Mocks Server that provides an API REST that allows to change the current mock, change delay time, and another Mocks Server options.

This is very useful when running acceptance tests, as you can change the current mock simply with a HTTP request in the before method of your tests, for example.

A client for the administration api is also distributed as a separated package: @mocks-server/admin-api-client.

Usage

This plugin is included in the main distribution of the Mocks Server project, so you can refer to the official documentation website.

Options

  • adminApiPath (String): Path for the administration api. Default is /admin. You should change it only in case there is any conflict with the api you are mocking.

Read more about how to set options in Mocks Server here.

API Resources

Available api resources are:

  • GET /admin/about Returns "plugin-admin-api" information.
    • Response body example: { "version": "1.2.0" }
  • GET /admin/mocks Returns mocks.
  • GET /admin/mocks/:id Returns a specific mock.
  • GET /admin/routes Returns routes collection.
  • GET /admin/routes/:id Returns a specific route.
  • GET /admin/routes-variants Returns routes variants collection.
  • GET /admin/routes-variants/:id Returns a specific route variant.
  • GET /admin/mock-custom-routes-variants Returns an array of currently custom routes variants ids.
  • POST /admin/mock-custom-routes-variants Defines a route variant to be used by current mock.
    • Request body example: { "id": "users:error" }
  • DELETE /admin/mock-custom-routes-variants Restore routes variants to those defined in current mock.
  • GET /admin/settings Returns current server settings.
    • Response body example: { "delay": 0, mock: "foo-mock", path: "mocks" }
  • PATCH /admin/settings Changes current server settings.
    • Request body example: { "delay": 3000 }
  • GET /admin/alerts Returns current alerts.
  • GET /admin/alerts/:id Returns a specific alert. The alert id is equivalent to the alert context (read the developing plugins chapter for further info about alerts).

Contributing

Contributors are welcome. Please read the contributing guidelines and code of conduct.

Keywords

FAQs

Package last updated on 03 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc