Giter VIP home page Giter VIP logo

pastebin-server's Introduction

pastebin-server

Deploy

$ cargo build --release
$ . ./start.sh

JSON API

  • POST /record

    interface Request{
        title: string,
        lang: string,
        content: string,
        expiration: number,
    }
    interface Response{
        key: string
    }
  • GET /record/{key}

    interface Response{
        title: string,
        lang: string,
        content: string,
        saving_time: number,
        expiration: number,
        view_count: number
    }
  • Error

    interface Error{
        code: number,
        message: string
    }

Environment

Prefix: PASTEBIN_

Shared Variable

var default unit description
ADDR localhost:8088 Binding address
CRYPT_KEY magic Crypto key for short url
MAX_POST_SIZE 32768 byte Max length of POST request body

Built-in Memory Store

var default unit description
MAX_STORE_SIZE 104857600 byte An ambiguous size count for controlling server memory usage
MAX_EXPIRATION 604800 second Max expiration time
CLEAN_DURATION 5000 millisecond GC interval

Redis Store

var default unit description
REDIS_URL set PASTEBIN_REDIS_URL to enable redis store

Example

.env

RUST_LOG=info
PASTEBIN_ADDR=localhost:8000
PASTEBIN_CRYPT_KEY=MyImportantSecret
PASTEBIN_REDIS_URL=redis://localhost:6379

pastebin-server's People

Contributors

nugine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.