Simplified HTML minification for GraphQL playground macro statement
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
fc3b323a5d
commit
4272ceb5ac
2 changed files with 8 additions and 4 deletions
|
@ -26,7 +26,9 @@ module Backend
|
|||
# Runs API service
|
||||
def run(_unit : ::Service::Unit) : ::Service::Unit?
|
||||
Log.info { "Starting Api service..." }
|
||||
WebServer.new.run
|
||||
server = WebServer.new
|
||||
server.draw_routes
|
||||
server.run
|
||||
Log.info { "Api service stopped." }
|
||||
|
||||
::Service::Unit.new(self)
|
||||
|
|
|
@ -27,7 +27,11 @@ module Backend
|
|||
# GraphQL playground HTML code
|
||||
#
|
||||
# NOTE: Is minified in production
|
||||
GRAPHQL_PLAYGROUND = {{ flag?(:development) ? read_file("#{__DIR__}/playground.html") : run("./macros/minify_html.cr", read_file("#{__DIR__}/playground.html")).stringify }}
|
||||
GRAPHQL_PLAYGROUND = {% if flag?(:development) %}
|
||||
{{ read_file("#{__DIR__}/playground.html") }}
|
||||
{% else %}
|
||||
{{ run("./macros/minify_html.cr", read_file("#{__DIR__}/playground.html")).stringify }}
|
||||
{% end %}
|
||||
|
||||
# GraphQL request data serializer
|
||||
struct GraphQLQueryData
|
||||
|
@ -80,8 +84,6 @@ module Backend
|
|||
|
||||
# Runs the webserver with according middleware
|
||||
def run : Nil
|
||||
draw_routes
|
||||
|
||||
server = HTTP::Server.new([
|
||||
HTTP::LogHandler.new,
|
||||
HTTP::ErrorHandler.new,
|
||||
|
|
Loading…
Reference in a new issue