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

mock-server

v1.3.3

Published

Your friendly mock server

Downloads

227

Readme

Mock Server

Your friendly mock server

Node server that easily allows for development and testing of SPA application running against production services.

Features

  • Remote Service Proxy
  • Local file override of remote proxy
  • Mock data sources
  • CORS remapping
  • Cookie remapping
  • Browser live reload

Server Mode

Server mode allows for setup of simple testing servers that eases the testing process for features that are currently under development.

  • Automated rebuild from github pushes
  • Branch selection
  • Heroku support
  • Campfire notifications

Setup

  1. In the root of the SPA application create mock-server.json. See example.
  2. (Optional) Define package.json with build dependencies (lumbar, grunt)
  3. Deploy to heroku
  4. git clone [email protected]:walmartlabs/mock-server.git
  5. heroku create
  6. Setup git repo heroku config:add MOCK_REPO=repoAddress

Private Repository Access

mock-server can be configured to access private git repositories through the GIT_SSH, MOCK_KEY, and MOCK_PUB environment variables.

$ heroku config:add \
    GIT_SSH="/app/git_ssh.sh" \
    MOCK_KEY="`cat ~/.ssh/id_rsa`" \
    MOCK_PUB="`cat ~/.ssh/id_rsa.pub`"

Automatic Rebuild

Github automatic updates are achieved through github push receive hooks combined with a githubpub publisher.

  1. Setup a githubpub instance or use the public one
  2. Add a webhook to the git repository. This should be http://$server/githubpub/$group
  3. Add PUBNUB variables to mock-server instance
$ heroku config:add \
    PUBNUB_CHANNEL=channelName \
    PUBNUB_SUBSCRIBE_KEY=subscribeKey

Public Pubnub Instance

A public gitpubnub instance is available at https://secure-reef-1619.herokuapp.com/ with. This is public so conflict may occur between channel names and push events sent through this service may be read by anyone reading this document. This is not recommended for private project use.

Example web hook: https://secure-reef-1619.herokuapp.com/githubpub/channelName Subscribe Key: sub-c-1c0b5d78-eb3e-11e1-9de3-61dd1d151c11

Campfire

mock-server uses the same config as the Campfire heroku addon. If enabled mock-server will utilize the same config as the addon. Otherwise the following environment variables need to be configured.

$ heroku config:add \
     DEPLOYHOOKS_CAMPFIRE_API_KEY=apiKey \
     DEPLOYHOOKS_CAMPFIRE_ROOM=room \
     DEPLOYHOOKS_CAMPFIRE_SSL=1 \
     DEPLOYHOOKS_CAMPFIRE_URL=campfireServerName

In either case these mock-server specific vars need to be set:

  • INSTANCE_NAME : Name reported in campfire notifications. This can be any value but is generally set to the heroku server name.
  • CAMPFIRE_QUIET : Define to decrease the number of campfire notifications from the instance

Using other build systems

Mock-server comes with support for node build systems out of the box but any build system may be used if binaries are available. For more information on how to include additional binaries in the package, see the Heroku build pack documentation. Note that mock-server requires the node build pack so running additional build packs on the sytem will require the use of the multi build pack.

Example

An example project has been setup here.

Bitdeli Badge