Skip to content

Commit 4ff28c6

Browse files
authored
Stream line install and config docs (#152)
* first pass * remove unused * fix typos * update docs * remove secondary config method * add nix shell * fix tags * remove command line shell script * fail loudly without .env * debug logs * fix quiet mode * add warning and feedback * typos
1 parent 5d33340 commit 4ff28c6

File tree

16 files changed

+137
-205
lines changed

16 files changed

+137
-205
lines changed

.env.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
MOCKBIN_PORT=8080,
1+
MOCKBIN_PORT=8080
22
MOCKBIN_QUIET=false
33
MOCKBIN_REDIS=redis://127.0.0.1:6379

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

Procfile

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 20 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# Mockbin [![version][npm-version]][npm-url] [![License][npm-license]][license-url]
1+
# Mockbin ![version][npm-version] [![License][npm-license]][license-url]
22

3-
[![Build Status][travis-image]][travis-url]
4-
[![Downloads][npm-downloads]][npm-url]
5-
[![Dependencies][david-image]][david-url]
63
[![Gitter][gitter-image]][gitter-url]
74

85
Mockbin is used internally and maintained by [Kong](https://github.com/Kong), who also maintain the open-source API Gateway [Kong](https://github.com/Kong/kong).
@@ -11,12 +8,9 @@ Mockbin is used internally and maintained by [Kong](https://github.com/Kong), wh
118

129
- [Features](#features)
1310
- [Installation](#installation)
14-
- [Heroku](#heroku)
15-
- [Docker](#docker)
1611
- [Requirements](#requirements)
17-
- [Configuration](#configuration)
18-
- [Running](#running)
19-
- [Usage](#usage)
12+
- [Running with Node](#running-with-node)
13+
- [Running with Docker Compose](#running-with-docker-compose)
2014
- [Documentation](#documentation)
2115
- [Bugs and feature requests](#bugs-and-feature-requests)
2216
- [Contributing](#contributing)
@@ -32,68 +26,44 @@ Mockbin is used internally and maintained by [Kong](https://github.com/Kong), wh
3226

3327
## Installation
3428

35-
install from source or through [npm](https://www.npmjs.com/):
36-
3729
```shell
38-
npm install mockbin
30+
git clone https://github.com/Kong/mockbin.git ./mockbin
31+
cd mockbin
32+
cp .env.sample .env
33+
brew install fnm
34+
fnm use
35+
npm install
3936
```
4037

41-
### Heroku
42-
43-
[![Deploy][docker-image]][docker-url]
44-
45-
*read more on [Installation](docs/install.md)*.
46-
47-
### Docker
48-
49-
[![Docker][docker-logo]](docs/install.md#install-with-docker)
50-
51-
*read more on [Installation](docs/install.md#install-with-docker)*.
38+
Note: nvm, n or volta can be used instead of fnm.
5239

5340
### Requirements
5441

5542
other than the dependencies listed in [package.json](package.json) The following are required:
5643

5744
- [Redis](http://redis.io/)
5845

59-
### Configuration
60-
61-
you will need to tell *mockbin* where Redis is:
62-
63-
```shell
64-
npm config set mockbin:redis redis://127.0.0.1:6379
65-
```
66-
67-
By Default the server will run on port `8080`, you can customize the port like so:
68-
6946
```shell
70-
npm config set mockbin:port 8001
47+
brew install redis
48+
brew services start redis
7149
```
7250

73-
*read more on [Configuration](docs/config.md)*.
74-
75-
### Running
51+
Redis should be now running on localhost:6379
7652

77-
After installing the `npm` package you can now start the server like so:
53+
### Running with Node
7854

7955
```shell
8056
npm start
81-
NODE_DEBUG=mockbin npm run dev
57+
# OR watch for changes
58+
npm run dev
59+
# OR with debug logs
60+
DEBUG=mockbin npm run dev
8261
```
8362

84-
## Usage
63+
## Running with Docker Compose
8564

8665
```shell
87-
Usage: mockbin [options]
88-
89-
Options:
90-
91-
-h, --help output usage information
92-
-V, --version output the version number
93-
-p, --port <port> Port that the HTTP server will run on
94-
-r, --redis [dsn] Redis dsn
95-
-q, --quiet Disable console logging
96-
66+
docker compose up
9767
```
9868

9969
## Documentation
@@ -118,20 +88,7 @@ Editor preferences are available in the [editor config](.editorconfig) for easy
11888

11989
[license-url]: https://github.com/Kong/mockbin/blob/master/LICENSE
12090

121-
[travis-url]: https://travis-ci.org/Kong/mockbin
122-
[travis-image]: https://img.shields.io/travis/Kong/mockbin.svg?style=flat-square
123-
124-
[npm-url]: https://www.npmjs.com/package/mockbin
12591
[npm-license]: https://img.shields.io/npm/l/mockbin.svg?style=flat-square
12692
[npm-version]: https://img.shields.io/npm/v/mockbin.svg?style=flat-square
127-
[npm-downloads]: https://img.shields.io/npm/dm/mockbin.svg?style=flat-square
128-
129-
[david-url]: https://david-dm.org/Kong/mockbin
130-
[david-image]: https://img.shields.io/david/Kong/mockbin.svg?style=flat-square
131-
132-
[docker-image]: https://www.herokucdn.com/deploy/button.svg
133-
[docker-url]: https://heroku.com/deploy?template=https://github.com/Kong/mockbin
134-
[docker-logo]: https://d3oypxn00j2a10.cloudfront.net/0.16.0/images/pages/brand_guidelines/small_h.png
135-
13693
[gitter-url]: https://gitter.im/Kong/mockbin
13794
[gitter-image]: https://img.shields.io/badge/Gitter-Join%20Chat-blue.svg?style=flat-square

bin/mockbin

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ services:
22
app:
33
build: .
44
environment:
5-
REALM: prod
65
REDIS_URL: "//redis:6379"
76
links:
87
- redis

docs/api/bins.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,86 @@ Responds with a `Location` header with the newly created **Bin**, e.g. `Location
9191
9292
----
9393
94+
#### Update Bin
95+
96+
> ##### `PUT /bin/:id`
97+
98+
Updates a new **Bin** with a mock HTTP response as described by a [HAR Response Object](http://www.softwareishard.com/blog/har-12-spec/#response) body.
99+
100+
Responds with a `Location` header with the updated **Bin**, e.g. `Location: /bin/3c149e20-bc9c-4c68-8614-048e6023a108` *(the Bin ID is also repeated in the body)*
101+
102+
###### Request
103+
104+
> ```http
105+
> PUT /bin/3c149e20-bc9c-4c68-8614-048e6023a108 HTTP/1.1
106+
> Host: mockbin.org
107+
> Content-Type: application/json
108+
> Accept: application/json
109+
> Content-Length: 819
110+
>
111+
> {
112+
> "status": 200,
113+
> "statusText": "OK",
114+
> "httpVersion": "HTTP/1.1",
115+
> "headers": [
116+
> {
117+
> "name": "Date",
118+
> "value": "Wed, 21 Jan 2015 23:36:35 GMT"
119+
> },
120+
> {
121+
> "name": "Server",
122+
> "value": "Apache"
123+
> },
124+
> {
125+
> "name": "Transfer-Encoding",
126+
> "value": "chunked"
127+
> },
128+
> {
129+
> "name": "Content-Type",
130+
> "value": "text/html; charset=UTF-8"
131+
> },
132+
> {
133+
> "name": "Cache-Control",
134+
> "value": "max-age=7200"
135+
> },
136+
> {
137+
> "name": "Connection",
138+
> "value": "Keep-Alive"
139+
> },
140+
> {
141+
> "name": "Keep-Alive",
142+
> "value": "timeout=5, max=50"
143+
> },
144+
> {
145+
> "name": "Expires",
146+
> "value": "Thu, 22 Jan 2015 01:36:35 GMT"
147+
> }
148+
> ],
149+
> "cookies": [],
150+
> "content": {
151+
> "size": 70972,
152+
> "mimeType": "text/html",
153+
> "compression": -21
154+
> },
155+
> "redirectURL": "",
156+
> "headersSize": 323,
157+
> "bodySize": 70993
158+
> }
159+
> ```
160+
161+
###### Response
162+
163+
> ```http
164+
> HTTP/1.1 200 OK
165+
> Location: /bin/3c149e20-bc9c-4c68-8614-048e6023a108
166+
> Content-Type: application/json; charset=utf-8
167+
> Content-Length: 38
168+
>
169+
> "3c149e20-bc9c-4c68-8614-048e6023a108"
170+
> ```
171+
172+
----
173+
94174
#### Inspect Bin
95175
96176
> ##### `GET /bin/:id/view`

docs/config.md

Whitespace-only changes.

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
## Overview
1+
## Overview
22

33
### HTTP Methods
44

55
**Unless otherwise indicated**: all Endpoints will accept *any* HTTP request with *any* header, using *any of the supported* HTTP Methods: `DELETE`, `GET`, `HEAD`, `POST`, `PUT`, `OPTIONS`, `TRACE`, `COPY`, `LOCK`, `MKCOL`, `MOVE`, `PROPFIND`, `PROPPATCH`, `SEARCH`, `UNLOCK`, `REPORT`, `MKACTIVITY`, `CHECKOUT`, `MERGE`, `M-SEARCH`, `NOTIFY`, `SUBSCRIBE`, `UNSUBSCRIBE`, `PATCH`, `PURGE`
66

7-
```
7+
```shell
88
# GET
99
curl mockbin.org/request
1010

docs/install.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)