https://github.com/huytd/jsondb-rs
A RESTful JSON storage service
https://github.com/huytd/jsondb-rs
heroku json json-api rust-lang
Last synced: 4 months ago
JSON representation
A RESTful JSON storage service
- Host: GitHub
- URL: https://github.com/huytd/jsondb-rs
- Owner: huytd
- License: bsd-3-clause
- Created: 2019-12-06T09:15:27.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-22T17:52:16.000Z (over 5 years ago)
- Last Synced: 2025-07-31T00:54:51.121Z (5 months ago)
- Topics: heroku, json, json-api, rust-lang
- Language: Rust
- Homepage: https://snarky-json.herokuapp.com/
- Size: 29.3 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

jsondb-rs
# Usage
JSONdb is a RESTful JSON storage service that you can
use to quickly develop your mobile and web app, without
the need of any backend.
```
POST /storage create a new JSON entry
GET /storage/{id} read a JSON entry
PUT /storage/{id} update a JSON entry
```
# Deploy to Heroku
To deploy this application on Heroku, your have two options:
**Option 1: Click to deploy:**
[](https://heroku.com/deploy)
**Option 2: Deploy manually:**
```
$ clone https://github.com/huytd/jsondb-rs
$ cd jsondb-rs
$ heroku apps:create
$ heroku addons:create heroku-postgresql
$ heroku buildpacks:set https://github.com/emk/heroku-buildpack-rust
$ git push heroku master
```
**Note:** If you're using the 1-core Heroku free dyno, please expect
the build process to be 10-20 minutes at worst.
# Run on your own server
To run on your own server, assuming you already have these installed:
- [Rust](https://rustup.rs/) (stable edition)
- [PostgreSQL](https://www.postgresql.org/)
- [Diesel CLI](https://github.com/diesel-rs/diesel/tree/master/diesel_cli)
You can install `diesel-cli` using the following command:
```
$ cargo install diesel_cli --no-default-features --features postgres
```
First, clone the repo:
```
$ clone https://github.com/huytd/jsondb-rs
$ cd jsondb-rs
```
Create the `.env` file to config your `DATABASE_URL`, in the project's root:
```
$ echo DATABASE_URL=postgres://:@127.0.0.1/jsondb > .env
```
Initialize the database:
```
$ diesel setup
```
Run the migration to create the data tables:
```
$ diesel migration run
```
Run the app server:
```
$ cargo run --release
```
If everything is running, you can start [setup a systemd service](https://www.steadylearner.com/blog/read/How-to-deploy-Rust-Web-App#5-create-systemd-service-to-serve-your-web-application) to serve your app
and put it behind nginx, or so.