radws

1.0.0-alpha.7 • Public • Published

Radws

Rapid application development without servers

Getting Started

To use radws, install the node module:

npm install --save radws@latest

Create a radws app using the generators in generator-radws

Dev Server

You can use the dev server to test your routes and handlers locally before deploying to AWS.

npm run radws-dev-server

Then, connect to http://localhost:3000

And try the API explorer at http://localhost:3000/api_explorer

Document

const Document = require('radws/document');
const uuid = require('uuid/v4');
 
const Article = Document({
  region: 'us-east-1',
  accessKeyId: 'YOUR_ACCESS_KEY_ID',
  secretAccessKey: 'YOUR_SECRET_ACCESS_KEY',
  tableName: 'Articles',
  partitionKey: 'ID',
  partitionKeyGenerator: uuid,
  timestamps: true
});
 
Article.create({
  title: 'My first article',
  text: 'This is a pretty cool library'
})
.then(article => alert(`Successfully created article ${article.ID}`));

.all(filters)

.find(identifier)

.create(attributes)

.update(identifier, attributes)

.destroy(identifier)

Resource

const Resource = require('radws/resource');
const Article = require('./article');
 
// GET /articles/:id
exports.show = Resource.handler((request, render) => {
  return Article.find(request.params.id)
    .then(article => {
      render({ status: 200, body: { article }});
    });
});

.handler(callback)

Keywords

none

install

npm i radws

Downloadsweekly downloads

3

version

1.0.0-alpha.7

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability