https://github.com/arpith/tiny-database-server
An in-memory database server using node.js
https://github.com/arpith/tiny-database-server
Last synced: 22 days ago
JSON representation
An in-memory database server using node.js
- Host: GitHub
- URL: https://github.com/arpith/tiny-database-server
- Owner: arpith
- License: mit
- Created: 2016-03-04T12:50:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-22T17:06:11.000Z (over 10 years ago)
- Last Synced: 2025-02-25T14:50:34.454Z (over 1 year ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tiny Database Server
An in-memory database server using node.js
## Installation
1. `git clone https://github.com/arpith/tiny-database-server`
2. `cd tiny-database-server`
3. `npm install && npm start`
## Usage
The server is accessible on http://localhost:4000/
### Setting a value
`curl http://localhost:4000/set?key=value`
### Getting a value
`curl http://localhost:4000/get?key=name`
This will return the value previously stored.
### Getting a snapshot
`curl http://localhost:4000/get?snapshot=true`
This will return a JSON string of the database.
## Persistence
When the server starts up, a persistence client is also started that fetches a snapshot from the server every second and stores it on the filesystem. This file (database.json) is used to populate the database when the server is next started up.
## Running the tests
1. Install and start the server
2. In another terminal window/tab run `npm test`