Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flume-cloud-services/stor
[DEPRECATED] STOR provides a JSON database with the power of HTTP requests 🚀
https://github.com/flume-cloud-services/stor
database firestore http json json-database self-hosted stor stor-database
Last synced: about 2 months ago
JSON representation
[DEPRECATED] STOR provides a JSON database with the power of HTTP requests 🚀
- Host: GitHub
- URL: https://github.com/flume-cloud-services/stor
- Owner: flume-cloud-services
- License: mit
- Created: 2018-07-25T11:11:13.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-02T13:58:30.000Z (almost 5 years ago)
- Last Synced: 2024-04-24T22:20:47.304Z (5 months ago)
- Topics: database, firestore, http, json, json-database, self-hosted, stor, stor-database
- Language: TypeScript
- Homepage: https://flume-cloud-services.github.io/stor/
- Size: 123 KB
- Stars: 18
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
**STOR** provides a JSON database with the power of HTTP requests
## 1. Installation
*You need to install NodeJS first*
Just clone the repository :
git clone https://www.github.com/dimensi0n/stor.git
And run :
npm install
## 2. Configuration
Stor uses Environment variable :
STOR_MONGO_URI is the link to your MongoDB database
STOR_PORT is the port number you want the database to run on
STOR_PASSWORD is the token you will write for each request on the request header
STOR_CORS is the Cors config object : 1 if cors is enabled, by default is true; 0 if cors is disabled
STOR_CORS_WHITELIST (optionnal, the domain you want to be validate) Example: STOR_CORS_WHITELIST=www.mydomain.com,www.myotherdomain.comOnce you finished to complete this fields just transpile it :
npx tsc
## 3. Run it
If you want to run it just for testing you can launch it with this command :
npm start
## 4. Use it
Install the official js library :
npm install stor-js
Connect to your Stor database and select your table :
```js
const stor = require("stor-js");const Stor = new stor.Stor("link to your Stor database", "STOR_PASSWORD");
let users = Stor.Table("users");
```Then init your Stor database :
```js
users.Init([])
.then(res => res.text())
.then(body => console.log(body))
```
### Select All :
```js
users.SelectAll()
.then(res => res.json())
.then(body => console.log(body.content))
```
### Create :
```js
users.Create({name:'pierre'})
.then(res => res.text())
.then(body => console.log(body))
```
### Get where :
```js
users.Get('name', 'pierre')
.then(res => res.text())
.then(body => console.log(body))
```
*Get user when name is 'pierre'*### Update :
```js
users.Put('name', 'pierre', 'jean')
.then(res => res.text())
.then(body => console.log(body))
```
*Update user when name is 'pierre' to 'jean'*### Delete :
```js
users.Delete('name', 'jean')
.then(res => res.text())
.then(body => console.log(body))
```
*Delete user when name is 'jean'*