webmiddle

webmiddle

  • Getting Started
  • GitHub

›webmiddle

Introduction

  • Getting Started
  • Main concepts
  • Starter App

webmiddle

  • Evaluate
  • Resources
  • ErrorBoundary
  • WithOptions

Control Flow

  • Pipe
  • Parallel

Fetching

  • HttpRequest
  • Browser
  • Cookie Manager

Transforming

  • CheerioToJson
  • JSONSelectToJson

Storing

  • Resume

Remote execution

  • Server
  • Client

Resources

Resources can be:

  • created with context.createResource(name, contentType, content)
  • serialized with context.stringifyResource(resource)
  • deserialized with context.parseResource(data)
  • checked with context.isResource(target)

When using context.createResuorce a different class is instantiated depending on the contentType.

Different classes have different serialization and deserialization logic.

Follows a list with the built-in resource classes.

Resource

NameDescription
content-type(default)
stringifyContentCnverted to string by using String(). The null and undefined values are converted to the empty string.
parseContentthe value is just returned as is, since it is supposed to be a plain string.

JsonResource

NameDescription
content-typeapplication/json
stringifyContentJSON.stringify
parseContentJSON.parse

WebmiddleVirtualResource

NameDescription
content-typex-webmiddle-virtual

Extends JsonResource. Used for Virtual objects.

WebmiddleTypeResource

NameDescription
content-typex-webmiddle-type

Extends JsonResource, but has the ability to serialize Virtual and Resource objects in a reversible way, meaning that the deserialization step will recreate the actual Virtual and Resource instances with the correct types.

Note that when deserializing inner resources, their ID won't be the same as the original one, meaning a new Resource is created.

See the source code for stringifyContent and parseContent functions.

← PreviousNext →
  • Resource
  • JsonResource
  • WebmiddleVirtualResource
  • WebmiddleTypeResource
webmiddle
Docs
Getting StartedMain ConceptsStarter App
Community
Stack OverflowTwitter
More
GitHubStar
Copyright © 2018 Manuel Dell'Elce