Sha256: f3829ff0b59b2c07f3badcc4802851c606488c3cbf2de36241267286fe1f99d6

Contents?: true

Size: 569 Bytes

Versions: 1

Compression:

Stored size: 569 Bytes

Contents

require 'sinatra'
require_relative '../lib/skeleton/root'

server_port = ARGV[0]
set :port, server_port

File.open("#{Base::ROOT_DIR}/html/port", 'w+') { |f| f.write(server_port) }

get '/' do
  redirect "skeleton"
end

get '/:file' do
  domain = params[:file].split('.').last
  file = domain == params[:file] ? "#{domain}.html" : params[:file]
  send_file "#{Base::ROOT_DIR}/html/#{file}"
end

post '/:file' do
  domain = params[:file].split('.').last
  file = domain == params[:file] ? "#{domain}.html" : params[:file]
  send_file "#{Base::ROOT_DIR}/html/#{file}"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skeleton-ui-0.1.9 html/server.rb