Ditto
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v47View latest version
ditto is what happens when you combine a key/value store and an HTTP API
- Send some JSON to a path via an HTTP
PUTand the JSON will get stored on that path - Send a
GETrequest to any path you'vePUTdata on and it will be retrieved
ditto is useful for testing or prototyping an API that doesn't yet exist.
(using httpie, but you can send the request any way you like)
$ http PUT https://jkulton--fad998c882d711f092ca0224a6c84d84.web.val.run/books/1 \
x-api-key:SUPER_SECRET \
title="The Great Gatsby" \
cover_image="https://www.gutenberg.org/cache/epub/64317/pg64317.cover.medium.jpg"
HTTP/1.1 200 OK
$ http GET https://jkulton--fad998c882d711f092ca0224a6c84d84.web.val.run/books/1 \
x-api-key:SUPER_SECRET
HTTP/1.1 200 OK
{
"cover_image": "https://www.gutenberg.org/cache/epub/64317/pg64317.cover.medium.jpg",
"title": "The Great Gatsby"
}
- Fork the Val
- Create a
DITTO_API_KEYenv var - Ensure you pass the API key as a
x-api-keyheader with all your requests - Send
PUTrequests to a path to store data, sendGETrequests to a path to retrieve data - Have fun!