mirror of
https://github.com/mistergibson/gxg-server.git
synced 2026-08-15 02:15:59 -07:00
minor tweaks
This commit is contained in:
parent
fca03f29ee
commit
f2d5305fe0
2 changed files with 13 additions and 0 deletions
|
|
@ -449,6 +449,11 @@ module GxG
|
||||||
::File.expand_path("#{::GxG::SYSTEM.gxg_root()}/#{self.vfs_root()}")
|
::File.expand_path("#{::GxG::SYSTEM.gxg_root()}/#{self.vfs_root()}")
|
||||||
end
|
end
|
||||||
# ### API Support
|
# ### API Support
|
||||||
|
def publish_route(the_method=:get, path, options={}, &block)
|
||||||
|
if ::GxG::Services::service_available?(:www)
|
||||||
|
::GxG::SERVICES[:www].call_event({:publish_route => {:http_method => the_method, :path => path, :options => options, :code => block}}, ::GxG::DB[:administrator])
|
||||||
|
end
|
||||||
|
end
|
||||||
def publish_api()
|
def publish_api()
|
||||||
if ::GxG::Services::service_available?(:www)
|
if ::GxG::Services::service_available?(:www)
|
||||||
::GxG::SERVICES[:www].call_event({:publish_api => {:service => self, :path => "/#{@provides.to_s}"}}, ::GxG::DB[:administrator])
|
::GxG::SERVICES[:www].call_event({:publish_api => {:service => self, :path => "/#{@provides.to_s}"}}, ::GxG::DB[:administrator])
|
||||||
|
|
|
||||||
|
|
@ -297,6 +297,14 @@ www_service.on(:at_stop, {:description => "WWW Stop", :usage => "{ :at_stop => (
|
||||||
#
|
#
|
||||||
{:result => true}
|
{:result => true}
|
||||||
end
|
end
|
||||||
|
www_service.on(:publish_route, {:description => "Publish Route", :usage => "{ :publish_route => {:http_method => :get, :path => '/path', :options => {}, :code => proc}}", :public => false}) do |data, credential|
|
||||||
|
# Code Usage:
|
||||||
|
# ::GxG::SERVICES[:core].publish_route(:get,"/",{}) do |the_method,the_request,the_session|
|
||||||
|
# end
|
||||||
|
Node0.publish_route(data[:http_method], data[:path], data[:options, &data[:code])
|
||||||
|
#
|
||||||
|
{:result => true}
|
||||||
|
end
|
||||||
www_service.on(:publish_api, {:description => "Publish Service API", :usage => "{ :publish_api => {:service => (service-object), :path => '/path'} }", :public => false}) do |data, credential|
|
www_service.on(:publish_api, {:description => "Publish Service API", :usage => "{ :publish_api => {:service => (service-object), :path => '/path'} }", :public => false}) do |data, credential|
|
||||||
#
|
#
|
||||||
::GxGwww::publish_api(data[:service], data[:path])
|
::GxGwww::publish_api(data[:service], data[:path])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue