Web Server API
#10
It would most likely look like this:

-- handler.lua

StaticFileHandler = {}
StaticFileHandler.__index = StaticFileHandler

function StaticFileHandler.new(folder)
   local this = {}
   setmetatable(this, StaticFileHandler)
   this.folder = folder
   return this
end

function StaticFileHandler:handle_request(request)
  -- something to handle the request
  return response
end


-- main.lua

cWebServer:get().mount(StaticFileHandler.new("./public/")).onto("/")
Reply
Thanks given by:


Messages In This Thread
Web Server API - by yangm97 - 11-28-2016, 03:36 AM
RE: Web Server API - by NiLSPACE - 11-28-2016, 04:00 AM
RE: Web Server API - by yangm97 - 11-28-2016, 04:15 AM
RE: Web Server API - by xoft - 11-28-2016, 05:11 AM
RE: Web Server API - by yangm97 - 11-28-2016, 05:29 AM
RE: Web Server API - by ShadowCone - 11-28-2016, 05:56 AM
RE: Web Server API - by yangm97 - 11-28-2016, 06:08 AM
RE: Web Server API - by ShadowCone - 11-28-2016, 05:45 PM
RE: Web Server API - by sphinxc0re - 01-13-2017, 10:42 AM
RE: Web Server API - by sphinxc0re - 01-13-2017, 10:49 AM
RE: Web Server API - by yangm97 - 01-13-2017, 01:31 PM



Users browsing this thread: 1 Guest(s)