An open API service indexing awesome lists of open source software.

https://github.com/kacper1263/node.js-api-lowdb

Simple API supporting database (lowdb) with users.
https://github.com/kacper1263/node.js-api-lowdb

api-server database example express expressjs json lowdb

Last synced: 12 months ago
JSON representation

Simple API supporting database (lowdb) with users.

Awesome Lists containing this project

README

          

# Node.js API supporting database (lowdb) with users


## You don't have public IP for API?
Try [second branch with localtunnel](https://github.com/Kacper1263/node.js-API-lowdb/tree/localtunnel)


## How to install

- Clone repo
- Go to main folder (with app.js)
- Edit tunnel config in app.js
- Run npm install from command line




## How to run

- Run node app.js in the main folder




## API usage

### Get all users
Send GET request to .../api/v2/users
### Get one user
- Send GET request to .../api/v2/users/:id
- Send GET request to .../api/v2/users/:name (It will take the first user it finds!)

e.g. localhost:5000/api/v2/users/4 or localhost:5000/api/v2/users/kacper

### Add user
Send POST request to .../api/v2/users/



In body provide:
- name
- description





### Delete user
Send DELETE request to .../api/v2/users/:id

### Edit user data
Send PUT request to .../api/v2/users/:id
In body provide name or description. Information that will not be given will be loaded from the old content

### Delete all users
Send DELETE request to .../api/v2/users/

Your IP must be registered do delete all users

### Register
Send GET requiest to .../api/v2/register/

This will register your public IP


The project uses [lowdb](https://www.npmjs.com/package/lowdb) as a database.