Skip to content

Instantly share code, notes, and snippets.

@andrewaguiar
Last active March 5, 2020 15:09
Show Gist options
  • Save andrewaguiar/ab2876978ef2a3c0ad86d84a8964e198 to your computer and use it in GitHub Desktop.
Save andrewaguiar/ab2876978ef2a3c0ad86d84a8964e198 to your computer and use it in GitHub Desktop.
PReq

PReq

An simple sinatra boilerplate to mock requests (plus: using ngrok)

Install

mkdir preq
cd preq
wget https://gist.githubusercontent.com/andrewaguiar/ab2876978ef2a3c0ad86d84a8964e198/raw/5b18fd92922c3f69d60f5513bb4c4337925f3a53/README.md
wget https://gist.githubusercontent.com/andrewaguiar/ab2876978ef2a3c0ad86d84a8964e198/raw/5b18fd92922c3f69d60f5513bb4c4337925f3a53/app.rb
wget https://gist.githubusercontent.com/andrewaguiar/ab2876978ef2a3c0ad86d84a8964e198/raw/5b18fd92922c3f69d60f5513bb4c4337925f3a53/Gemfile
wget https://gist.githubusercontent.com/andrewaguiar/ab2876978ef2a3c0ad86d84a8964e198/raw/5b18fd92922c3f69d60f5513bb4c4337925f3a53/run
wget https://gist.githubusercontent.com/andrewaguiar/ab2876978ef2a3c0ad86d84a8964e198/raw/5b18fd92922c3f69d60f5513bb4c4337925f3a53/run-ngrok
chmod +x run
chmod +x run-ngrok
echo "yay"

Usage

# edit app.rb with your code
./run
# In another tab
./run-ngrok
# Access `http://localhost:4567` or the address given by ngrok
# frozen_string_literal: true
require 'sinatra'
require 'sinatra/reloader'
require 'oj'
get '/' do
'PReq'
end
# frozen_string_literal: true
source 'https://rubygems.org'
ruby '2.5.0'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end
gem 'oj'
gem 'sinatra'
gem 'sinatra-reloader'
gem 'thin'
#!/bin/bash
ruby app.rb
#!/bin/bash
ngrok http 4567
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment