-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adam Grohs
authored and
Adam Grohs
committed
May 31, 2019
1 parent
3541ff5
commit 672ef2c
Showing
15 changed files
with
18,656 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: 'circleci/node:lts' | ||
steps: | ||
- checkout | ||
- run: yarn clean-install | ||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: micro-requestbin-{{ checksum "package.json" }} | ||
test: | ||
docker: | ||
- image: 'circleci/node:lts' | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- micro-requestbin-{{ checksum "package.json" }} | ||
- run: yarn clean-install | ||
- run: yarn test | ||
release: | ||
docker: | ||
- image: 'circleci/node:lts' | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- micro-requestbin-{{ checksum "package.json" }} | ||
- run: yarn clean-install | ||
- run: npx semantic-release | ||
workflows: | ||
version: 2 | ||
build_test_release: | ||
jobs: | ||
- build | ||
- test: | ||
requires: | ||
- build | ||
- release: | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
requires: | ||
- test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
|
||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
|
||
- OS: [e.g. iOS] | ||
- Browser [e.g. chrome, safari] | ||
- Version [e.g. 22] | ||
|
||
**Smartphone (please complete the following information):** | ||
|
||
- Device: [e.g. iPhone6] | ||
- OS: [e.g. iOS8.1] | ||
- Browser [e.g. stock browser, safari] | ||
- Version [e.g. 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.test.* | ||
*.spec.* | ||
/__tests__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"semi": false, | ||
"trailingComma": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019-2025 UNIQUELY PARTICULAR LLC and Adam Grohs | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,56 @@ | ||
# micro-requestbin | ||
# @particular./micro-requestbin | ||
|
||
[![npm version](https://img.shields.io/npm/v/@particular./micro-requestbin.svg)](https://www.npmjs.com/package/@particular./micro-requestbin) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![CircleCI](https://img.shields.io/circleci/project/github/uniquelyparticular/micro-requestbin.svg?label=circleci)](https://circleci.com/gh/uniquelyparticular/micro-requestbin) ![dependency status: david](https://img.shields.io/david/uniquelyparticular/micro-requestbin.svg) | ||
|
||
> RequestBin implementation to log output of incoming requests | ||
Built with [Micro](https://github.com/zeit/micro)! 🤩 | ||
|
||
## 🛠 Setup | ||
|
||
Create a `.env` at the project root with the following credentials: | ||
|
||
```dosini | ||
REQUESTBIN_ORIGIN_WHITELIST=*.mysite.com,*.mycrmplaform.io,*.mycommerceplaform.com,*.now.sh | ||
``` | ||
|
||
`REQUESTBIN_ORIGIN_WHITELIST` is a comma separated list of patterns to match against the incoming requests 'Origin' header (ex. `localhost,*.myawesomesite.com,*.now.sh`) | ||
|
||
_Optional Additional Parameters_ | ||
|
||
```dosini | ||
REQUESTBIN_SECRET_HEADER=x-webhook-secret-key | ||
REQUESTBIN_SECRET_VALUE=zxasda | ||
``` | ||
|
||
`REQUESTBIN_SECRET_HEADER` will default to `'x-webhook-secret-key'` and is if a header is found that matches it to verify that the value sent matches anything you've specified as `REQUESTBIN_SECRET_VALUE` | ||
|
||
## 📦 Package | ||
|
||
Run the following command to build the app | ||
|
||
```bash | ||
yarn install | ||
``` | ||
|
||
Start the development server | ||
|
||
```bash | ||
yarn dev | ||
``` | ||
|
||
The server will typically start on PORT `3000`, if not, make a note for the next step. | ||
|
||
Start ngrok (change ngrok port below from 3000 if yarn dev deployed locally on different port above) | ||
|
||
```bash | ||
ngrok http 3000 | ||
``` | ||
|
||
Make a note of the https `ngrok URL` provided. | ||
|
||
## 🚀 Deploy | ||
|
||
You can easily deploy this function to [now](https://now.sh). | ||
|
||
_Contact [Adam Grohs](https://www.linkedin.com/in/adamgrohs/) @ [Particular.](https://uniquelyparticular.com) for any questions._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
roots: ['<rootDir>/src', '<rootDir>/tests', '<rootDir>/spec'], | ||
transform: { | ||
'^.+\\.ts(x)?$': 'ts-jest' | ||
}, | ||
verbose: true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"version": 2, | ||
"name": "demo-micro-requestbin", | ||
"alias": "particular-micro-requestbin.now.sh", | ||
"env": { | ||
"NODE_ENV": "production", | ||
"REQUESTBIN_ORIGIN_WHITELIST": "@demo-requestbin-origin-whitelist" | ||
}, | ||
"routes": [{ "src": "/(.*)", "dest": "/src" }], | ||
"builds": [ | ||
{ | ||
"src": "src/*.js", | ||
"use": "@now/node" | ||
} | ||
] | ||
} |
Oops, something went wrong.
672ef2c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully aliased the URL https://demo-micro-requestbin-mkykwxf3w.now.sh to the following aliases.