https://github.com/mark24code/sinatra-mock-template
Micro Mock Server
https://github.com/mark24code/sinatra-mock-template
Last synced: 11 months ago
JSON representation
Micro Mock Server
- Host: GitHub
- URL: https://github.com/mark24code/sinatra-mock-template
- Owner: Mark24Code
- License: mit
- Created: 2021-05-06T07:07:44.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-28T08:07:50.000Z (over 4 years ago)
- Last Synced: 2025-01-24T01:08:20.087Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sinatra Mock template
Restful JSON Mock Server
(Sinatra + Mock + JSON API + Faker + CORS)
# prepare
## install
* Make sure you have bundler
install bundle
run `gem install bundler`
* Install dependency gems
enter project directory
run `bundle install`
* Run mock server
run `bundle exec rake`
* Add mock files
enter `mocks/` ,create `xxx.mock.rb`
when you can edit your mock ruby script.
make sure `require "sinatra"` was code on top of script file.
```ruby
get '/' do
# just return the response object
{
content: "hello world",
}
end
post '/user' do
{
content: "hello world",
}
end
```
the app will collect all pattern like `xxx.mock.rb` into routers.
when you change file, it will hotreload.
enjoy~