npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

akera-rest-crud

v1.0.7

Published

Akera-web REST data access (CRUD) component

Downloads

10

Readme

Akera Logo

REST database access module (CRUD) for Akera.io web service - used by rest explorer module and other mobile/web clients this broker middleware service provides access to connected databases on the application server. Both meta-data information (database structure) and create/read/update/delete (CRUD) operations are supported.

Installation

$ npm install akera-rest-crud

Docs

Quick Start

This module is designed to only be loaded as broker level service which is usually done by adding a reference to it in services section of each broker's configuration in akera-web.json configuration file.

  "brokers": [
  	{	"name": "demo",
  		"host": "localhost",
		"port": 3737,
		"services": [
			{ 
				"middleware": "akera-rest-crud",
				"config": {
					"route": "/rest-crud/"
				}
			}
		]
	}
  ]

Service options available: - route: the route where the service is going to be mounted (default: '/rest/crud/')

The interface can then be used to retrieve meta-data information about connected databases, create/read/update/delete records from those databases by making HTTP requests:

| Method | Url | Function | Result | | --- | --- | --- | --- | | GET | http://[host]/[broker]/rest-crud/[db]/[table] | reads records from database table, optional query parameters (filter, sort, limit, offset) can be sent using the filter parameter through the HTTP query string | HTTP 404 if no record found, JSON object if only one record found or array if multiple | | GET | http://[host]/[broker]/rest-crud/[db]/[table]/[id](/[id])* | reads a single record from database table, primary key field(s) values should be sent as URL segments in the same order as in the primary index definition | HTTP 404 if record not found, JSON object if found | | GET | http://[host]/[broker]/rest-crud/[db]/[table]/count | returns number of records from database table, optional query filter can be sent using the filter parameter through the HTTP query string | JSON object with num property holding the number of records | | POST | http://[host]/[broker]/rest-crud/[db]/[table] | create a new record in database table, the request body should be a JSON object holding values to be set for each table's fields | HTTP 500 if error on create, JSON object with full table record (fields might be set in database triggers) | | PUT | http://[host]/[broker]/rest-crud/[db]/[table]/rowid/[id] | update a record in database table using the ROWID value sent as last URL segment and the request body should be a JSON object holding values to be set for each table's fields | HTTP 404 if record not found, HTTP 500 if error on update, JSON object with full table record (fields might be updated in database triggers) | | PUT | http://[host]/[broker]/rest-crud/[db]/[table]/[id](/[id])* | update a record in database table, primary key field(s) values should be sent as URL segments and the request body should be a JSON object holding values to be set for each table's fields | HTTP 404 if record not found, HTTP 500 if error on update, JSON object with full table record (fields might be updated in database triggers) | | DELETE | http://[host]/[broker]/rest-crud/[db]/[table]/rowid/[id] | delete a record from database table, primary key field(s) values should be sent as URL segments | HTTP 404 if record not found, HTTP 500 if error on delete, JSON object with num property holding the number of records deleted | | DELETE | http://[host]/[broker]/rest-crud/[db]/[table]/[id](/[id])* | delete a record from database table using the ROWID value sent as last URL segment | HTTP 404 if record not found, HTTP 500 if error on delete, JSON object with num property holding the number of records deleted | | GET | http://[host]/[broker]/rest-crud/meta | returns the list of connected databases | JSON array with one string entry for each connected database containing the database logical name | | GET | http://[host]/[broker]/rest-crud/meta/[db] | returns the list of database's tables, db parameter can be either the database name or zero-base index | HTTP 404 if database not found, JSON array with one string entry for each database table containing the table name | | GET | http://[host]/[broker]/rest-crud/meta/[db]/[table] | returns database table's field information, table parameter can be either the database name or zero-base index | HTTP 404 if table not found, JSON array with one entry for each table field | | GET | http://[host]/[broker]/rest-crud/meta/[db]/[table]/index | returns database table's indexes information, table parameter can be either the database name or zero-base index | HTTP 404 if table not found, JSON array with one entry for each table index |

License

MIT