diff --git a/dev/api/index.html b/dev/api/index.html index 32b15efc..f7201bf7 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,2 +1,2 @@ -Api · Oxygen.jl

Api

Documentation for Oxygen.jl

Starting the webserver

Oxygen.serveFunction
serve(; middleware::Vector=[], handler=stream_handler, host="127.0.0.1", port=8080, async=false, parallel=false, serialize=true, catch_errors=true, docs=true, metrics=true, show_errors=true, show_banner=true, docs_path="/docs", schema_path="/schema", external_url=nothing, kwargs...)

Start the webserver with your own custom request handler

source
Oxygen.serveparallelFunction
serveparallel(; middleware::Vector=[], handler=stream_handler, host="127.0.0.1", port=8080, serialize=true, async=false, catch_errors=true, docs=true, metrics=true, kwargs...)
source

Routing

Oxygen.@getMacro
@get(path::String, func::Function)

Used to register a function to a specific endpoint to handle GET requests

source
Oxygen.@postMacro
@post(path::String, func::Function)

Used to register a function to a specific endpoint to handle POST requests

source
Oxygen.@putMacro
@put(path::String, func::Function)

Used to register a function to a specific endpoint to handle PUT requests

source
Oxygen.@patchMacro
@patch(path::String, func::Function)

Used to register a function to a specific endpoint to handle PATCH requests

source
Oxygen.@deleteMacro
@delete(path::String, func::Function)

Used to register a function to a specific endpoint to handle DELETE requests

source
Oxygen.@routeMacro
@route(methods::Array{String}, path::String, func::Function)

Used to register a function to a specific endpoint to handle mulitiple request types

source
Missing docstring.

Missing docstring for get(path, func). Check Documenter's build log for details.

Missing docstring.

Missing docstring for post(path, func). Check Documenter's build log for details.

Missing docstring.

Missing docstring for put(path, func). Check Documenter's build log for details.

Missing docstring.

Missing docstring for patch(path, func). Check Documenter's build log for details.

Missing docstring.

Missing docstring for delete(path, func). Check Documenter's build log for details.

Missing docstring.

Missing docstring for route(methods, path, func). Check Documenter's build log for details.

Mounting Files

Oxygen.@staticfilesMacro
@staticfiles(folder::String, mountdir::String, headers::Vector{Pair{String,String}}=[])

Mount all files inside the /static folder (or user defined mount point)

source
Oxygen.@dynamicfilesMacro
@dynamicfiles(folder::String, mountdir::String, headers::Vector{Pair{String,String}}=[])

Mount all files inside the /static folder (or user defined mount point), but files are re-read on each request

source
Oxygen.staticfilesFunction
staticfiles(folder::String, mountdir::String; headers::Vector{Pair{String,String}}=[], loadfile::Union{Function,Nothing}=nothing)

Mount all files inside the /static folder (or user defined mount point). The headers array will get applied to all mounted files

source
Oxygen.dynamicfilesFunction
dynamicfiles(folder::String, mountdir::String; headers::Vector{Pair{String,String}}=[], loadfile::Union{Function,Nothing}=nothing)

Mount all files inside the /static folder (or user defined mount point), but files are re-read on each request. The headers array will get applied to all mounted files

source

Autogenerated Docs

Oxygen.configdocsFunction
configdocs(docspath::String = "/docs", schemapath::String = "/schema")

Configure the default docs and schema endpoints

source
Missing docstring.

Missing docstring for enabledocs. Check Documenter's build log for details.

Missing docstring.

Missing docstring for disabledocs. Check Documenter's build log for details.

Missing docstring.

Missing docstring for isdocsenabled. Check Documenter's build log for details.

Oxygen.mergeschemaFunction
mergeschema(route::String, customschema::Dict)

Merge the schema of a specific route

mergeschema(customschema::Dict)

Merge the top-level autogenerated schema with a custom schema

source

Helper functions

Oxygen.Core.Util.formdataFunction
formdata(request::HTTP.Request)

Read the html form data from the body of a HTTP.Request

source
formdata(request::HTTP.Response)

Read the html form data from the body of a HTTP.Response

source
Oxygen.Core.Util.htmlFunction
html(content::String; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as HTML

source
Oxygen.Core.Util.textFunction
text(request::HTTP.Request)

Read the body of a HTTP.Request as a String

source
text(response::HTTP.Response)

Read the body of a HTTP.Response as a String

source
text(content::String; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as plain text

source
Oxygen.Core.Util.fileFunction
file(filepath::String; loadfile=nothing, status = 200, headers = []) :: HTTP.Response

Reads a file and returns a HTTP.Response. The file is read as binary. If the file does not exist, an ArgumentError is thrown. The MIME type and the size of the file are added to the headers.

Arguments

  • filepath: The path to the file to be read.
  • loadfile: An optional function to load the file. If not provided, the file is read using the open function.
  • status: The HTTP status code to be used in the response. Defaults to 200.
  • headers: Any additional headers to be included in the response. Defaults to an empty array.

Returns

  • A HTTP response.
source
Oxygen.Core.Util.xmlFunction
xml(content::String; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as XML

source
Oxygen.Core.Util.jsFunction
js(content::String; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as JavaScript

source
Oxygen.Core.Util.jsonFunction
json(request::HTTP.Request; keyword_arguments...)

Read the body of a HTTP.Request as JSON with additional arguments for the read/serializer.

source
json(request::HTTP.Request, classtype; keyword_arguments...)

Read the body of a HTTP.Request as JSON with additional arguments for the read/serializer into a custom struct.

source
json(response::HTTP.Response; keyword_arguments)

Read the body of a HTTP.Response as JSON with additional keyword arguments

source
json(response::HTTP.Response, classtype; keyword_arguments)

Read the body of a HTTP.Response as JSON with additional keyword arguments and serialize it into a custom struct

source
json(content::Any; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as JSON

source
json(content::Vector{UInt8}; status::Int, headers::Vector{Pair}) :: HTTP.Response

A helper function that can be passed binary data that should be interpreted as JSON. No conversion is done on the content since it's already in binary format.

source
Oxygen.Core.Util.cssFunction
css(content::String; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as CSS

source
Oxygen.Core.Util.binaryFunction
binary(request::HTTP.Request)

Read the body of a HTTP.Request as a Vector{UInt8}

source
binary(content::Vector{UInt8}; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a Vector of UInt8 that should be interpreted as binary data

source

Repeat Tasks & Cron Scheduling

Oxygen.@cronMacro
@cron(expression::String, func::Function)

Registers a function with a cron expression. This will extract either the function name or the random Id julia assigns to each lambda function.

source
@cron(expression::String, name::String, func::Function)

This variation provides way manually "name" a registered function. This information is used by the server on startup to log out all cron jobs.

source
Oxygen.startcronjobsFunction
startcronjobs()

Start all the cron cronjobs within their own async task. Each individual task will loop conintually and sleep untill the next time it's suppost to

source
Oxygen.stopcronjobsFunction
stopcronjobs()

Stop each background task by toggling a global reference that all cron jobs reference

source
Missing docstring.

Missing docstring for clearcronjobs. Check Documenter's build log for details.

Extra's

Oxygen.routerFunction

No documentation found.

Binding Oxygen.Core.AutoDoc.router does not exist.

source
Oxygen.internalrequestFunction
internalrequest(req::HTTP.Request; middleware::Vector=[], serialize::Bool=true, catch_errors::Bool=true)

Directly call one of our other endpoints registered with the router, using your own middleware and bypassing any globally defined middleware

source
+Api · Oxygen.jl

Api

Documentation for Oxygen.jl

Starting the webserver

Oxygen.serveFunction
serve(; middleware::Vector=[], handler=stream_handler, host="127.0.0.1", port=8080, async=false, parallel=false, serialize=true, catch_errors=true, docs=true, metrics=true, show_errors=true, show_banner=true, docs_path="/docs", schema_path="/schema", external_url=nothing, kwargs...)

Start the webserver with your own custom request handler

source
Oxygen.serveparallelFunction
serveparallel(; middleware::Vector=[], handler=stream_handler, host="127.0.0.1", port=8080, serialize=true, async=false, catch_errors=true, docs=true, metrics=true, kwargs...)
source

Routing

Oxygen.@getMacro
@get(path::String, func::Function)

Used to register a function to a specific endpoint to handle GET requests

source
Oxygen.@postMacro
@post(path::String, func::Function)

Used to register a function to a specific endpoint to handle POST requests

source
Oxygen.@putMacro
@put(path::String, func::Function)

Used to register a function to a specific endpoint to handle PUT requests

source
Oxygen.@patchMacro
@patch(path::String, func::Function)

Used to register a function to a specific endpoint to handle PATCH requests

source
Oxygen.@deleteMacro
@delete(path::String, func::Function)

Used to register a function to a specific endpoint to handle DELETE requests

source
Oxygen.@routeMacro
@route(methods::Array{String}, path::String, func::Function)

Used to register a function to a specific endpoint to handle mulitiple request types

source
Missing docstring.

Missing docstring for get(path, func). Check Documenter's build log for details.

Missing docstring.

Missing docstring for post(path, func). Check Documenter's build log for details.

Missing docstring.

Missing docstring for put(path, func). Check Documenter's build log for details.

Missing docstring.

Missing docstring for patch(path, func). Check Documenter's build log for details.

Missing docstring.

Missing docstring for delete(path, func). Check Documenter's build log for details.

Missing docstring.

Missing docstring for route(methods, path, func). Check Documenter's build log for details.

Mounting Files

Oxygen.@staticfilesMacro
@staticfiles(folder::String, mountdir::String, headers::Vector{Pair{String,String}}=[])

Mount all files inside the /static folder (or user defined mount point)

source
Oxygen.@dynamicfilesMacro
@dynamicfiles(folder::String, mountdir::String, headers::Vector{Pair{String,String}}=[])

Mount all files inside the /static folder (or user defined mount point), but files are re-read on each request

source
Oxygen.staticfilesFunction
staticfiles(folder::String, mountdir::String; headers::Vector{Pair{String,String}}=[], loadfile::Union{Function,Nothing}=nothing)

Mount all files inside the /static folder (or user defined mount point). The headers array will get applied to all mounted files

source
Oxygen.dynamicfilesFunction
dynamicfiles(folder::String, mountdir::String; headers::Vector{Pair{String,String}}=[], loadfile::Union{Function,Nothing}=nothing)

Mount all files inside the /static folder (or user defined mount point), but files are re-read on each request. The headers array will get applied to all mounted files

source

Autogenerated Docs

Oxygen.configdocsFunction
configdocs(docspath::String = "/docs", schemapath::String = "/schema")

Configure the default docs and schema endpoints

source
Missing docstring.

Missing docstring for enabledocs. Check Documenter's build log for details.

Missing docstring.

Missing docstring for disabledocs. Check Documenter's build log for details.

Missing docstring.

Missing docstring for isdocsenabled. Check Documenter's build log for details.

Oxygen.mergeschemaFunction
mergeschema(route::String, customschema::Dict)

Merge the schema of a specific route

mergeschema(customschema::Dict)

Merge the top-level autogenerated schema with a custom schema

source

Helper functions

Oxygen.Core.Util.formdataFunction
formdata(request::HTTP.Request)

Read the html form data from the body of a HTTP.Request

source
formdata(request::HTTP.Response)

Read the html form data from the body of a HTTP.Response

source
Oxygen.Core.Util.htmlFunction
html(content::String; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as HTML

source
Oxygen.Core.Util.textFunction
text(request::HTTP.Request)

Read the body of a HTTP.Request as a String

source
text(response::HTTP.Response)

Read the body of a HTTP.Response as a String

source
text(content::String; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as plain text

source
Oxygen.Core.Util.fileFunction
file(filepath::String; loadfile=nothing, status = 200, headers = []) :: HTTP.Response

Reads a file and returns a HTTP.Response. The file is read as binary. If the file does not exist, an ArgumentError is thrown. The MIME type and the size of the file are added to the headers.

Arguments

  • filepath: The path to the file to be read.
  • loadfile: An optional function to load the file. If not provided, the file is read using the open function.
  • status: The HTTP status code to be used in the response. Defaults to 200.
  • headers: Any additional headers to be included in the response. Defaults to an empty array.

Returns

  • A HTTP response.
source
Oxygen.Core.Util.xmlFunction
xml(content::String; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as XML

source
Oxygen.Core.Util.jsFunction
js(content::String; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as JavaScript

source
Oxygen.Core.Util.jsonFunction
json(request::HTTP.Request; keyword_arguments...)

Read the body of a HTTP.Request as JSON with additional arguments for the read/serializer.

source
json(request::HTTP.Request, classtype; keyword_arguments...)

Read the body of a HTTP.Request as JSON with additional arguments for the read/serializer into a custom struct.

source
json(response::HTTP.Response; keyword_arguments)

Read the body of a HTTP.Response as JSON with additional keyword arguments

source
json(response::HTTP.Response, classtype; keyword_arguments)

Read the body of a HTTP.Response as JSON with additional keyword arguments and serialize it into a custom struct

source
json(content::Any; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as JSON

source
json(content::Vector{UInt8}; status::Int, headers::Vector{Pair}) :: HTTP.Response

A helper function that can be passed binary data that should be interpreted as JSON. No conversion is done on the content since it's already in binary format.

source
Oxygen.Core.Util.cssFunction
css(content::String; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a String that should be interpreted as CSS

source
Oxygen.Core.Util.binaryFunction
binary(request::HTTP.Request)

Read the body of a HTTP.Request as a Vector{UInt8}

source
binary(content::Vector{UInt8}; status::Int, headers::Vector{Pair}) :: HTTP.Response

A convenience function to return a Vector of UInt8 that should be interpreted as binary data

source

Repeat Tasks & Cron Scheduling

Oxygen.@cronMacro
@cron(expression::String, func::Function)

Registers a function with a cron expression. This will extract either the function name or the random Id julia assigns to each lambda function.

source
@cron(expression::String, name::String, func::Function)

This variation provides way manually "name" a registered function. This information is used by the server on startup to log out all cron jobs.

source
Oxygen.startcronjobsFunction
startcronjobs()

Start all the cron cronjobs within their own async task. Each individual task will loop conintually and sleep untill the next time it's suppost to

source
Oxygen.stopcronjobsFunction
stopcronjobs()

Stop each background task by toggling a global reference that all cron jobs reference

source
Missing docstring.

Missing docstring for clearcronjobs. Check Documenter's build log for details.

Extra's

Oxygen.routerFunction

No documentation found.

Binding Oxygen.Core.AutoDoc.router does not exist.

source
Oxygen.internalrequestFunction
internalrequest(req::HTTP.Request; middleware::Vector=[], serialize::Bool=true, catch_errors::Bool=true)

Directly call one of our other endpoints registered with the router, using your own middleware and bypassing any globally defined middleware

source
diff --git a/dev/index.html b/dev/index.html index de043cea..c4e65f68 100644 --- a/dev/index.html +++ b/dev/index.html @@ -630,4 +630,4 @@ ) ) ) -)

API Reference (macros)

@get, @post, @put, @patch, @delete

  @get(path, func)
ParameterTypeDescription
pathstring or router()Required. The route to register
funcfunctionRequired. The request handler for this route

Used to register a function to a specific endpoint to handle that corresponding type of request

@route

  @route(methods, path, func)
ParameterTypeDescription
methodsarrayRequired. The types of HTTP requests to register to this route
pathstring or router()Required. The route to register
funcfunctionRequired. The request handler for this route

Low-level macro that allows a route to be handle multiple request types

staticfiles

  staticfiles(folder, mount)
ParameterTypeDescription
folderstringRequired. The folder to serve files from
mountdirstringThe root endpoint to mount files under (default is "static")
set_headersfunctionCustomize the http response headers when returning these files
loadfilefunctionCustomize behavior when loading files

Serve all static files within a folder. This function recursively searches a directory and mounts all files under the mount directory using their relative paths.

dynamicfiles

  dynamicfiles(folder, mount)
ParameterTypeDescription
folderstringRequired. The folder to serve files from
mountdirstringThe root endpoint to mount files under (default is "static")
set_headersfunctionCustomize the http response headers when returning these files
loadfilefunctionCustomize behavior when loading files

Serve all static files within a folder. This function recursively searches a directory and mounts all files under the mount directory using their relative paths. The file is loaded on each request, potentially picking up any file changes.

Request helper functions

html()

  html(content, status, headers)
ParameterTypeDescription
contentstringRequired. The string to be returned as HTML
statusintegerThe HTTP response code (default is 200)
headersdictThe headers for the HTTP response (default has content-type header set to "text/html; charset=utf-8")

Helper function to designate when content should be returned as HTML

queryparams()

  queryparams(request)
ParameterTypeDescription
reqHTTP.RequestRequired. The HTTP request object

Returns the query parameters from a request as a Dict()

Body Functions

text()

  text(request)
ParameterTypeDescription
reqHTTP.RequestRequired. The HTTP request object

Returns the body of a request as a string

binary()

  binary(request)
ParameterTypeDescription
reqHTTP.RequestRequired. The HTTP request object

Returns the body of a request as a binary file (returns a vector of UInt8s)

json()

  json(request, classtype)
ParameterTypeDescription
reqHTTP.RequestRequired. The HTTP request object
classtypestructA struct to deserialize a JSON object into

Deserialize the body of a request into a julia struct

+)

API Reference (macros)

@get, @post, @put, @patch, @delete

  @get(path, func)
ParameterTypeDescription
pathstring or router()Required. The route to register
funcfunctionRequired. The request handler for this route

Used to register a function to a specific endpoint to handle that corresponding type of request

@route

  @route(methods, path, func)
ParameterTypeDescription
methodsarrayRequired. The types of HTTP requests to register to this route
pathstring or router()Required. The route to register
funcfunctionRequired. The request handler for this route

Low-level macro that allows a route to be handle multiple request types

staticfiles

  staticfiles(folder, mount)
ParameterTypeDescription
folderstringRequired. The folder to serve files from
mountdirstringThe root endpoint to mount files under (default is "static")
set_headersfunctionCustomize the http response headers when returning these files
loadfilefunctionCustomize behavior when loading files

Serve all static files within a folder. This function recursively searches a directory and mounts all files under the mount directory using their relative paths.

dynamicfiles

  dynamicfiles(folder, mount)
ParameterTypeDescription
folderstringRequired. The folder to serve files from
mountdirstringThe root endpoint to mount files under (default is "static")
set_headersfunctionCustomize the http response headers when returning these files
loadfilefunctionCustomize behavior when loading files

Serve all static files within a folder. This function recursively searches a directory and mounts all files under the mount directory using their relative paths. The file is loaded on each request, potentially picking up any file changes.

Request helper functions

html()

  html(content, status, headers)
ParameterTypeDescription
contentstringRequired. The string to be returned as HTML
statusintegerThe HTTP response code (default is 200)
headersdictThe headers for the HTTP response (default has content-type header set to "text/html; charset=utf-8")

Helper function to designate when content should be returned as HTML

queryparams()

  queryparams(request)
ParameterTypeDescription
reqHTTP.RequestRequired. The HTTP request object

Returns the query parameters from a request as a Dict()

Body Functions

text()

  text(request)
ParameterTypeDescription
reqHTTP.RequestRequired. The HTTP request object

Returns the body of a request as a string

binary()

  binary(request)
ParameterTypeDescription
reqHTTP.RequestRequired. The HTTP request object

Returns the body of a request as a binary file (returns a vector of UInt8s)

json()

  json(request, classtype)
ParameterTypeDescription
reqHTTP.RequestRequired. The HTTP request object
classtypestructA struct to deserialize a JSON object into

Deserialize the body of a request into a julia struct

diff --git a/dev/search/index.html b/dev/search/index.html index 1116858e..65ff3bbf 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · Oxygen.jl

Loading search...

    +Search · Oxygen.jl

    Loading search...

      diff --git a/dev/tutorial/bigger_applications/index.html b/dev/tutorial/bigger_applications/index.html index a64399bc..be67bd41 100644 --- a/dev/tutorial/bigger_applications/index.html +++ b/dev/tutorial/bigger_applications/index.html @@ -118,4 +118,4 @@ HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 -15.0""" +15.0""" diff --git a/dev/tutorial/cron_scheduling/index.html b/dev/tutorial/cron_scheduling/index.html index ee1590e0..f2764f6d 100644 --- a/dev/tutorial/cron_scheduling/index.html +++ b/dev/tutorial/cron_scheduling/index.html @@ -35,4 +35,4 @@ @cron "0 0/30 8-10 * * *" function() println("runs at 8:00, 8:30, 9:00, 9:30, 10:00 and 10:30 every day") -end

      Starting & Stopping Cron Jobs

      When you run serve() or serveparallel(), all registered cron jobs are automatically started. If the server is stopped or killed, all running jobs will also be terminated. You can stop the server and all repeat tasks and cron jobs by calling the terminate() function or manually killing the server with ctrl+C.

      In addition, Oxygen provides utility functions to manually start and stop cron jobs: startcronjobs() and stopcronjobs(). These functions can be used outside of a web server as well.

      +end

      Starting & Stopping Cron Jobs

      When you run serve() or serveparallel(), all registered cron jobs are automatically started. If the server is stopped or killed, all running jobs will also be terminated. You can stop the server and all repeat tasks and cron jobs by calling the terminate() function or manually killing the server with ctrl+C.

      In addition, Oxygen provides utility functions to manually start and stop cron jobs: startcronjobs() and stopcronjobs(). These functions can be used outside of a web server as well.

      diff --git a/dev/tutorial/first_steps/index.html b/dev/tutorial/first_steps/index.html index b3a9f66a..4dd0cc88 100644 --- a/dev/tutorial/first_steps/index.html +++ b/dev/tutorial/first_steps/index.html @@ -16,4 +16,4 @@ end

      Start the webserver with:

      include("src/main.jl")

      Line by line

      using Oxygen
       using HTTP

      Here we pull in the both libraries our api depends on. The @get macro and serve() function come from Oxygen and the HTTP.Request type comes from the HTTP library.

      Next we move into the core snippet where we define a route for our api. This route is made up of several components.

      @get "/greet" function(req::HTTP.Request)
           return "hello world!"
      -end

      Finally at the bottom of our Main module we have this function to start up our brand new webserver. This function can take a number of keyword arguments such as the host & port, which can be helpful if you don't want to use the default values.

      serve()

      For example, you can start your server on port 8000 instead of 8080 which is used by default

      serve(port=8000)

      Try out your endpoints

      You should see the server starting up inside the console. You should be able to hit http://127.0.0.1:8080/greet inside your browser and see the following:

      "hello world!"

      Interactive API documenation

      Open your browser to http://127.0.0.1:8080/docs Here you'll see the auto-generated documentation for your api. This is done internally by generating a JSON object that conforms to the openapi format. Once generated, you can feed this same schema to libraries like swagger which translate this into an interactive api for you to explore.

      +end

      Finally at the bottom of our Main module we have this function to start up our brand new webserver. This function can take a number of keyword arguments such as the host & port, which can be helpful if you don't want to use the default values.

      serve()

      For example, you can start your server on port 8000 instead of 8080 which is used by default

      serve(port=8000)

      Try out your endpoints

      You should see the server starting up inside the console. You should be able to hit http://127.0.0.1:8080/greet inside your browser and see the following:

      "hello world!"

      Interactive API documenation

      Open your browser to http://127.0.0.1:8080/docs Here you'll see the auto-generated documentation for your api. This is done internally by generating a JSON object that conforms to the openapi format. Once generated, you can feed this same schema to libraries like swagger which translate this into an interactive api for you to explore.

      diff --git a/dev/tutorial/oauth2/index.html b/dev/tutorial/oauth2/index.html index ebd16b87..dfffa6ec 100644 --- a/dev/tutorial/oauth2/index.html +++ b/dev/tutorial/oauth2/index.html @@ -67,4 +67,4 @@ end # start the web server -serve() +serve() diff --git a/dev/tutorial/path_parameters/index.html b/dev/tutorial/path_parameters/index.html index 4745eec2..d4c80ef5 100644 --- a/dev/tutorial/path_parameters/index.html +++ b/dev/tutorial/path_parameters/index.html @@ -62,4 +62,4 @@ return float end -serve() +serve() diff --git a/dev/tutorial/query_parameters/index.html b/dev/tutorial/query_parameters/index.html index 06642186..69cd38c3 100644 --- a/dev/tutorial/query_parameters/index.html +++ b/dev/tutorial/query_parameters/index.html @@ -5,4 +5,4 @@ end

      If we hit this route with a url like the one below we should see the query parameters returned as a JSON object

      {
           "debug": "true",
           "limit": "10"
      -}

      The important distinction between query parameters and path parameters is that they are not automatically converted for you. In this example debug & limit are set to a string even though those aren't the "correct" data types.

      +}

      The important distinction between query parameters and path parameters is that they are not automatically converted for you. In this example debug & limit are set to a string even though those aren't the "correct" data types.

      diff --git a/dev/tutorial/request_body/index.html b/dev/tutorial/request_body/index.html index b3188bb9..1ccdc583 100644 --- a/dev/tutorial/request_body/index.html +++ b/dev/tutorial/request_body/index.html @@ -14,4 +14,4 @@ # this will convert the request body into a Julia Dict data = json(req) return """hello $(data["name"])!""" -end

      When converting JSON into struct's Oxygen will throw an error if the request body doesn't match the struct, all properties need to be visible and match the right type.

      If you don't pass a struct to convert the JSON into, then it will convert the JSON into a Julia Dictionary. This has the benefit of being able to take JSON of any shape which is helpful when your data can change shape or is unknown.

      +end

      When converting JSON into struct's Oxygen will throw an error if the request body doesn't match the struct, all properties need to be visible and match the right type.

      If you don't pass a struct to convert the JSON into, then it will convert the JSON into a Julia Dictionary. This has the benefit of being able to take JSON of any shape which is helpful when your data can change shape or is unknown.

      diff --git a/dev/tutorial/request_types/index.html b/dev/tutorial/request_types/index.html index 71b0b4cd..e20c5226 100644 --- a/dev/tutorial/request_types/index.html +++ b/dev/tutorial/request_types/index.html @@ -6,4 +6,4 @@ return HTTP.get("https://api.weather.gov/alerts/active?area=$state") end -serve()

      With our code in place, we can run this code and visit the endpoint in our browser to view the alerts. Try it out yourself by clicking on the link below.

      http://127.0.0.1:8080/weather/alerts/NY

      +serve()

      With our code in place, we can run this code and visit the endpoint in our browser to view the alerts. Try it out yourself by clicking on the link below.

      http://127.0.0.1:8080/weather/alerts/NY