# File storage

GitHub release (latest by date) (opens new window) Docker Build Status (opens new window)

API to submit files using multipart forms and statically serve them afterwards.

# Getting Started

Want a File Storage API of your own? The easiest way is to deploy our docker container. Just follow the steps below to get started.

# Requirements

# Deployment

  1. Set the DOMAIN environment variable. e.g.:
    export DOMAIN=localhost:3000 // or
    export DOMAIN=github.com
    
  2. [optional] Set INSECURE to true if you are NOT using HTTPS.
  3. Start the container with a single command
    docker run --name file-storage-api -p 3000:3000 -d ghcr.io/dot-base/file-storage-api:latest
    
  4. Done and dusted 🎉. The File Storage API is available on port 3000.

# Configuration

All configuration is done through environment variables. You can adjust the environment variables of the container by appending -e to the command above. You can use the examples below to adjust your command or build your own command using the docker run reference (opens new window).

# Sentry

The File Storage API has build-in support for Sentry (opens new window) as an error monitoring and distributed tracing service. You can enable the sentry integration by setting the following two environment variables:

  1. Set SENTRY_DSN to the DSN of your Sentry project.

    How do I get the DSN of my Sentry Project?

    You can get the DSN of your Sentry poject at: https://sentry.io/settings/{SENTRY_ORGANIZATION_NAME}/projects/{SENTRY_PROJECT_NAME}/keys/ (Hint: Replace Placeholders).

    export SENTRY_DSN="REPLACE_THIS_WITH_YOUR_SENTRY_DSN"
    
  2. Set SENTRY_ENVIRONMENT to the Sentry environment you want to log the events to. The default environment is production.

    export SENTRY_ENVIRONMENT="production"
    
  3. With both variables set you command will look like this:

    docker run --name file-storage-api -p 3000:3000 -d ghcr.io/dot-base/file-storage-api:latest -e SENTRY_DSN -e SENTRY_ENVIRONMENT
    

# API Documentation

# Contributing

This project is written in Typescript. For an introduction into the language and best practices see the typescript documentation (opens new window).

# Requirements

# Running Locally

  1. Install all dependencies
    npm install
    
  2. Set the DOMAIN environment variable. e.g.:
    export DOMAIN=localhost:3000
    
  3. Start the development server
    npm start
    
  4. By default the server is available at http://localhost:3000.
  5. Go and mix up some code 👩‍💻. The server will reload automatically once you save. Remember to keep an eye on the console.