npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

moki

v1.0.20

Published

a CLI-application & js-framework to build a mock of a restful api.

Downloads

5

Readme

Moki - [experimental]

... mocks your backend

experimental

Moki is an easy way to mock a rest-api and is usefull for Web- & Mobile-developers to build rest-based clients without the needs to run a real server.

Status

Build Status HitCount Gitter Dependency Status

Roadmap

Important: This software is permanently in development, so please use it carefuly.

Important: nodejs from V.6 doesn't support EventEmitter. So you will get a warning in console. currently i test this project only until v5.

Why? start with why

Frontend-developers doesn't like to work with broken services. They prefer to write UI code and expects a full working service with predictable behaviour. Later, if a product has a bug and for example fails in user acceptance tests, then a frontend-developer is the first instance who will be asked by the customer. The web-developer has to explain why the application doesn't work as expected. Even if the problem is a produced by a broken service.

Moki is a way to setup a rest-api with static (and dynamic) responses. So a web-developer get simple a way to develop against a not implemented service. Web-developer can configure response in different way, depends on a catched request and matched parameters.

Getting started

Requirements

  • nodejs
  • npm

Installation

Install moki with npm. To install moki global accessible you can use the -g option:

npm install -g moki

Working directory

Change to (project-) directory where you want to manage your rest-api mocks.

Configure mocks

To create a mock for a specified rest-request moki supports a json-based dsl. This json file with some mock-declarations inside we will call 'usecase'.

Example:

{
  "mocks" : [{

    "on" : {
      "endpoint": {
        "method": "get",
        "pattern": "/items",
        "path": "/items"
      }

    },

    "action" : { "items" : ["Apple", "Pineapple"] }
  }]
}

Save this content in a text file './usecases/usecase-1.json'.

Run

To run moki with above described usecase open command line and enter:

moki run usecase-1

Moki will resolve the name of usecase to a file, load the mock-declarations and start the server at http://localhost:8383/.

To test the endpoint open in the browser this url: http://localhost:8383/items

Important: http-Port is configurable

More docs

Alternative solutions

There are already some solutions on the market. Check them out. (List ist not complete)

Node based solutions

  • https://www.npmjs.com/package/mock-restful
  • https://www.npmjs.com/package/api-mock
  • https://www.npmjs.com/package/mock-rest-request
  • https://github.com/typicode/json-server
  • http://www.mock-json-api.com/

More mocking servers

  • http://www.mock-server.com/where/npm.html http://wiremock.org

Swagger based mocks

  • https://www.npmjs.com/package/swagger-mock
  • https://github.com/dzdrazil/swagger-mock-api
  • https://www.npmjs.com/package/swagger-server

Services

  • https://www.mockable.io/
  • http://mocky.io

The MIT License (MIT)

Copyright (c) 2016 Andreas Siebert

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.