Backend API of a bin website.
JavaScript Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
scripts
test
.editorconfig
.gitignore
.jshintrc
.travis.yml
Procfile
README.md
package.json

README.md

AnyBin

A boilerplate bin website for saving text in a database and access it with a short URL. Very similar to PasteBin or JSBin. This is mostly back-end implementation of the website. Front-end is very simple.

Try a version of the app running here

Work in progress

Features

Running locally

git clone git@github.com:mohsen1/anybin.git
cd anybin
npm install
npm run dev

Server command line options

  • config for selecting the configuration file
  • views for selecting the folder to look for index.ejs file
  • public for selecting public content folder
  • db MongoDB URL, it will override database URLs in config.js
Example
$ node app/server.js \
  --config='/path/to/my/config.js' \
  --views='/path/to/my/views-folder/' \
  --public='/path/to/my/public-folder' \
  --db='mongodb://user:pass@me.dbhost.com:9999/my-db'

Routes

Website
Operation Path Description
GET / Load homepage
GET /?import=url Load homepage and import from url
GET /:id Load a bin
GET /:id/:version Load a bin at a version
API
Operation Path Description
POST /api/ Make a new Bin
POST /api?import=url Make a new Bin form url
GET /api/:id Get latest version of a bin
PUT /api/:id Update latest version of a bin
POST /api/:id Add a new version to a bin
GET /api/:/id/:version Get a specific version of a bin

License

MIT