• Stars
    star
    140
  • Rank 261,473 (Top 6 %)
  • Language
    JavaScript
  • License
    Other
  • Created almost 9 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A plugin-based tool for running fake HTTP and socket services

frock

A plugin-based tool for running fake HTTP and socket services.

Build Status npm install js-standard-style

frock is a tool for running fake services and serving mock data. It's designed for developers who work in service-oriented architectures, and need to stand up fake services that approximate production services in their development environments.

frock itself is a host for running HTTP and socket services, and its HTTP router makes it simple to run multiple services on the same port. Outside of the core functions of starting services and routing to handlers, frock's functionality is implemented through plugins and middleware that you write.

There are some generic plugins provided for out-of-the-box functionality:

  • frock-static is a plugin for serving static content from files, directories, or URLs.
  • frock-proxy is a plugin for proxying requests from frock to a remote server.

For a quick overview of the functionality frock provides, see the example in this README.

Quick-Start Example

frock is a Node.js CLI utility, which loads a frockfile from your project directory. In the following example, we'll create a service that proxies requests to your local development server at http://localhost:8052, but intercepts some URLs to serve static content from a variety of sources.

In your working directory, create a frockfile.json:

{
  "servers": [
    {
      "port": 8080,
      "routes": [
        {
          "path": "/api/segments",
          "methods": ["GET"],
          "handler": "frock-static",
          "options": {
            "file": "fixtures/static/segments.json",
            "contentType": "application/json"
          }
        },
        {
          "path": "/api/remote",
          "methods": ["GET"],
          "handler": "frock-static",
          "options": {
            "url": "http://raw.githubusercontent.com/somewhere/something.json",
            "contentType": "application/json"
          }
        },
        {
          "path": "*",
          "methods": "any",
          "handler": "frock-proxy",
          "options": {
            "url": "http://localhost:8052"
          }
        }
      ]
    }
  ]
}

Install frock and the plugins you requested:

$ npm install frock frock-static frock-proxy

Then, run frock:

$ frock

This examples expects that your PATH is set to run Node.js packages from your project's installed node_modules; see the Understanding Packages section of the documentation for details.

Note: By default, frock only allows connections from localhost; see the docs on connection filtering for details.

Detailed Documentation

frock's documentation is split into several sections:

  • Using frock in your project/Understanding Packages is an overview of how frock is meant to sit alongside your project.
  • Implementing mocks/fakes:
    • Plugins: writing plugins, where you'll implement your fake services.
    • Middleware: writing middleware, which can augment your plugins' functionality.
    • Cores: writing cores, which can extend the core functionality of frock.
  • frockfile Reference, which explains the configuration file format that frock uses, the frockfile.json
  • Examples which provides detailed examples of using frock, and can help you understand how to implement your fake services.
  • API details the frock API, which can be used programatically rather than via the provided CLI. This also documents the frock singleton your plugins will be passed when they are instantiated.

CLI

The frock command will search upward from your current directory for a frockfile.json, and run it.

Use the built-in help to learn about other options:

$ frock --help

Some options can be set via environment variables; these provide defaults, which can still be overridden by explicitly passing CLI flags. Set these to any value besides an empty string to set the default to true:

  • FROCK_DEBUG set the log level to debug
  • FROCK_RAW_OUTPUT output the raw log JSON rather than pretty-printing
  • FROCK_UNSAFE_DISABLE_CONNECTION_FILTERING disable processing of whitelists/blacklists for connections, and allow any incoming connections

Testing

From the project directory:

$ npm test

Any test file that should be run must be required in the tests/index.js file.

License

Apache 2.0, see LICENSE for details.

More Repositories

1

ios-library

Urban Airship iOS SDK
Swift
474
star
2

datacube

Multidimensional data storage with rollups for numerical data
Java
264
star
3

ruby-library

A Ruby wrapper for the Urban Airship API.
Ruby
201
star
4

urbanairship-cordova

Urban Airship integration with Apache Cordova
JavaScript
142
star
5

techladder

Job titles and descriptions for UA engineering
Makefile
113
star
6

android-library

Urban Airship Android SDK
Kotlin
111
star
7

react-native-airship

Airship React Native module
TypeScript
88
star
8

python-library

A Python library for using the Airship APIs for push notifications, reporting and other message types
Python
82
star
9

ios-phonegap-plugin

This repo is deprecated. Please see: https://github.com/urbanairship/phonegap-ua-push
JavaScript
69
star
10

statshtable

Java
45
star
11

drive.js

Drive.js makes testing JavaScript applications easy, wherever they live
JavaScript
43
star
12

php-library2

Urban Airship PHP Library
PHP
38
star
13

java-library

Java client library for the Urban Airship API
Java
33
star
14

android-samples

DEPRECATED - Use https://github.com/urbanairship/android-library instead
Java
33
star
15

mvn-python-packaging

A code sample and article describing how maven can be used to build python packages.
Python
32
star
16

beanstalk-munin

Munin plugins for Beanstalkd written in Python
Python
30
star
17

ios-samples

A collection of samples using the Urban Airship ios-library
Objective-C
26
star
18

aerostat

Cloud Naming Client/Service
Python
25
star
19

hbackup

Java
22
star
20

go-iapclient

A Google Cloud Platform Identity Aware Proxy authentication library for Golang
Go
20
star
21

airship-flutter

Flutter integration
Dart
17
star
22

ua-unity-plugin

C#
15
star
23

ua-ios-pod

a project for staging, testing and managing Urban Airship's cocoapod situation
Objective-C
15
star
24

pubsubsuperfeedr

Simple Python library to interface with Superfeedr's pubsubhubbub interface.
Python
10
star
25

titanium-module

Urban Airship Titanium module
Swift
9
star
26

urbanairship-xamarin

Urban Airship Xamarin Libraries
C#
9
star
27

node-connect-client

A node client for connecting to the Urban Airship Connect API.
JavaScript
8
star
28

passtools-api

Official documentation and resources for the PassTools API
8
star
29

pykafkap

Python Kafka Producer
Python
7
star
30

connect-java-library

Java client library for Urban Airship Connect
Java
6
star
31

django-subforms

An implementation of Hierarchical forms and form-to-model mapping.
Python
6
star
32

objectstate

Streaming state management for node and the browser
JavaScript
6
star
33

django-finial

Hierarchical template overriding on a per request basis.
Python
5
star
34

bb-push-sample-os5

BlackBerry push notification sample application, OS 5.0 and up
Java
5
star
35

android-gimbal-adapter

The Android Gimbal adapter for Urban Airship
Java
5
star
36

django-mithril

IP (v4 and v6) Whitelisting for Django
Python
5
star
37

connect-json-schema

JSON Schema for connect events
4
star
38

bb-push-sample-os4

BlackBerry push notification sample application, OS 4.x compatible
Java
4
star
39

passtools-ruby

Official Ruby SDK for the PassTools API
Ruby
4
star
40

kiddiepool

Python Client Driver Pool
Python
4
star
41

tap-set-exit

Sets the correct exit code based on tap output.
JavaScript
4
star
42

dedupe-stream

A stream that prevents consecutive duplicate emissions.
JavaScript
3
star
43

sarlacc-pit

Library for maintaining a complete in-memory copy of a remote data source.
Java
3
star
44

android-automator-utils

This project contains utilities that are used for UI Automation testing.
Java
3
star
45

google-v3-geocoder

Geokit::Geocoder subclass for interacting with google's v3 geocoder
3
star
46

ios-gimbal-adapter

The iOS Gimbal adapter for Urban Airship
Swift
3
star
47

ua-api-utils

Urban Airship API Utilities
Python
2
star
48

frock-middleware-delay

Delay middleware for frock. Introduce some latency.
JavaScript
2
star
49

passtools-java

Official Java SDK for the PassTools API
Java
2
star
50

object-cursor-stream

de-duped keypath stream
JavaScript
2
star
51

frock-static

A static file server for frock
JavaScript
2
star
52

apptimize-ios-kit

Swift
2
star
53

passtools-python

Official Python SDK for the PassTools API
Python
2
star
54

api-specs

OpenAPI specs for Airship APIs
2
star
55

logbot

IRC Logging Bot
Python
2
star
56

frock-proxy

A proxy plugin for frock
JavaScript
2
star
57

accengage-mobile-react-native

React Native module wrapping Android and iOS SDKs
Objective-C
2
star
58

padlocker-client

Encryption key dispersion service - Client
Python
2
star
59

cordova-gimbal-bridge

Gimbal Phongap plugin that uses the GimbalAdapter
Objective-C
2
star
60

streaming-set

A stream which adds objects written to it to a set, and then emits the updated array.
JavaScript
2
star
61

mongotools

Python tools for working with MongoDB
Python
1
star
62

connect-python-library

Python client library for Urban Airship Connect
Python
1
star
63

apptimize-flutter

Apptimize Flutter Plugin for iOS and Android
Dart
1
star
64

urbanairship-accengage-cordova

DEPRECATED
1
star
65

accengage-ios-sdk-releases

The Accengage iOS Framework Releases
1
star
66

capacitor-airship

TypeScript
1
star
67

cordova-gimbal-sdk

Objective-C
1
star
68

ios-pod-specs

Repository for Accengage CocoaPods specifications.
Ruby
1
star
69

android-ga-tracker

Android extension to the Google Analytics SDK
Java
1
star
70

react-native-gimbal-adapter

Objective-C
1
star
71

apptimize-qa-console-ios

Preview variants in different combinations from all of your active feature flags and experiments.
Swift
1
star
72

airship-mobile-framework-proxy

Kotlin
1
star
73

accengage-android-sdk-samples

Java
1
star
74

react-native-acc-fcm

Accengage FCM Plugin for React Native
Java
1
star
75

reach-python-library

Python client library for Urban Airship Reach
Python
1
star
76

airship-dotnet

C#
1
star
77

break-the-intranet

Hack week / Intranet
JavaScript
1
star
78

apptimize-qa-console-android

Java
1
star
79

accengage-android-lib-sample

Java
1
star
80

analytics-swift-apptimize

Swift
1
star
81

cordova-firebase-app-init

Java
1
star
82

ua-extensions

Urban Airship extensions repository houses drop in classes that provide additional functionality for the Urban Airship SDK
Objective-C
1
star
83

padlocker-server

Encryption key dispersion service - Server
JavaScript
1
star
84

ios-segment-integration

A simple way to integrate Urban Airship and Segment.
Objective-C
1
star