#1 2014-02-09 08:39:28

mingda
Member
Registered: 2013-01-04
Posts: 121

Any possibility to have a build in Web Server to server static content

now we have ORM, Rest Server, for web front, we also need a simple web server to server static file, search forum there are also some similar demand, is there any possibility to have a build in Web Server, for example, sub class of TSQLHttpServer, accessional to server a directory content, thanks!

Offline

#2 2014-02-09 18:20:36

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,225
Website

Re: Any possibility to have a build in Web Server to server static content

See sample "09 - HttpApi web server" for a stand-alone Web Server at TSQLHttpServer level.

See also "22 - JavaScript HTTPApi web server" for something even more complete, including server-side JavaScript scripting!
smile

You can mix ORM and web server on the same TSQLHttpServer instance, of course.
One possibility is to use a method-based service, which will return the content of a directory by using STATICFILE_CONTENT_TYPE in the response headers, and supplying the file name as body (encoded as UTF-8).
See both 09 and 22 samples about how this works.

Offline

#3 2014-02-10 10:42:11

mingda
Member
Registered: 2013-01-04
Posts: 121

Re: Any possibility to have a build in Web Server to server static content

thank you ab, I know the example, i think if it's a common demand, why always reinvent the wheel, if has a build in web server, then can enhanced it step by step, since there are some function is not easy to implement.

Offline

Board footer

Powered by FluxBB