Skip to content

Endpoints for uploading webcontainer projects #29

@fennifith

Description

@fennifith

Prerequisite for #20, so that webcontainer code embeds can be uploaded from hoof either during a build/deployment, from a dev environment, or (future) from the web UI.

Endpoint drafts:

POST /projects/{id}/new (multipart/form-data)

Form data includes either an md5 hash or a zip file. Submits a task with the same content.

Returns: 201 Created


GET /projects/{id}/versions/{md5}

Check if the project exists in S3. If it has an expiry, refresh it to last another week.

Returns: 200 OK or 404 Not Found

{
  "snapshotUrl": "https://{{S3_PUBLIC_URL}}/..."
}

The lifecycle for a webcontainer project is:

  • POST to /projects/{id}/new
    • Uploads the project content (if provided) to a private S3 bucket & submits a task
  • Start a task (Task to create webcontainer snapshots for project embeds #20)
    • If the content was not provided, download it from GitHub (this will only occur during main deployment)
    • Download npm dependencies & build the snapshot (no code from the snapshot should be evaluated)
    • Upload the snapshot to the public S3 bucket
      • If the project was not downloaded from GitHub, set a 1 week expiration on the S3 object (as it should only exist in dev mode)
  • GET to /projects/{id}/versions/{md5}
    • If the project exists in S3, return its public URL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions