JSPM

@architect/sandbox

1.2.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4895
  • Score
    100M100P100Q129322F
  • License Apache-2.0

Run Architect projects locally

Package Exports

  • @architect/sandbox

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@architect/sandbox) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@architect/sandbox Travis Build Status Appveyor Build Status codecov

Run an @architect project in a local sandbox.

Install

npm i @architect/sandbox

API

sandbox.cli({ver}, callback)

Will use specified ver or use the version string defined in this project's package.json.

Invokes sandbox.start() to start a sandbox instance, passing the parameter object in. Then sets up a filesystem watcher for changes to:

  1. any files within the shared/ folder, in which case it will re-hydrate all functions with the new files, and
  2. the .arc file, in which case it will re-start the HTTP server by calling into [http()][http].

sandbox.db.start(callback)

Starts a singleton in-memory dynalite dynamodb server, automatically creating any tables or indexes defined by the .arc file. Also creates a local session table.

Returns an object with a close() method that shuts the server down.

Invokes callback once the db is up and listening.

sandbox.events.start(callback)

If the .arc file defines queues or events, sets up interprocess communication between your events and queues via a tiny web server.

Returns an object with a close() method that shuts the server down.

Invokes callback once the servers are listening.

sandbox.http.start(callback)

If the .arc file defines http or websocket routes, starts the necessary servers and sets up routes as defined in the .arc file.

Invokes callback once the servers are listening.

sandbox.http.close()

Closes any servers started via sandbox.http.start().

sandbox.start({port, options}, callback)

Checks that ports are available to consume, prints a banner, and sets up any local DBs via sandbox.db.start(), events or queues via sandbox.events.start(), HTTP handlers via sandbox.http.start().

Invokes callback once everything is ready, passing null as the first parameter and end as the second parameter to callback, where end is a function that closes all servers down.

Returns a promise if callback is falsy.

Example Usage

let sandbox = require('@architect/sandbox')