Commit 6a2dd4c
Changed files (3)
Gemfile
@@ -1,3 +1,4 @@
source "https://rubygems.org"
-gem "sinatra"
+gem 'sinatra'
+gem 'json'
Gemfile.lock
@@ -1,6 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
+ json (1.8.1)
rack (1.5.2)
rack-protection (1.5.2)
rack
@@ -14,4 +15,5 @@ PLATFORMS
ruby
DEPENDENCIES
+ json
sinatra
hi.rb
@@ -0,0 +1,11 @@
+require "sinatra"
+require 'json'
+
+get '/login/:id/:password' do |id, password|
+ content_type :json
+ if id == "1" && password == '1234'
+ { success: true }.to_json
+ else
+ { success: false }.to_json
+ end
+end