Giter Site home page Giter Site logo

crud.js's Introduction

CRUD.js

Minimal code for CRUD operations on REST APIs with JavaScript

CRUD.js is an easy way to consume RESTful APIs in JavaScript.

Where to use CRUD.js?

You can use CRUD.js to make it done complete CRUD operations on a REST service with a minimal number of code anywhere you can use JavaScript, very specially on single page web applications.

Features

  1. Call Rest API CRUD with minimum code.
  2. Ability to use ui templates of your own.
  3. If no templates are used fall back to default html template.

Usage

Below is quick example how to use CRUD.js:

$(document).ready(function(){ 
    $.CRUD.path = "http://www.example.com/api"; 
    var Book= new $.CRUD("book");
    Book.list(); 
}); 

This could be the only JavaScript codes you have to write for the whole application.

Application-Wide Configuration Parameters:

  $.CRUD.path // root URL for REST API
  $.CRUD.container // where the HTML content should be embeded; default is 'container'
  $.CRUD.resources // root folder for external templates; default is 'res'

In this example, the CRUD.path config property takes one parameter to the ROOT URL of your REST API. The constructor is passed the Table you want to operate on.
When we invoke list method on the object all the CRUD operations on this Table.

Load External Templates

<table>
    <a href="#!add" data-action="add" >Add</a>
    {{#Books}}
    <tr>
        <td>
            {{Id}}
        </td>
        <td>
             {{Title}}
        </td>
        <td>
            <a href="#!view" data-action="view" data-id="{{Id}}">View</a>
            <a href="#!edit" data-action="edit" data-id="{{Id}}">Edit</a>
            <a href="#!delete" data-action="delete" data-id="{{Id}}">Delete</a>
        </td>
    </tr>
    {{/Books}}
</table> 

In here we have used mustache.js as the templating framework.

Data Attributes

	data-action // CRUD operations like view, update, delete,..
	data-id // Unique identifier for the record

Thanks

CRUD.js wouldn't kick ass if it weren't for these fine souls:

Gayan Kulatilleke

Git: tidalbobo
E-mail: [email protected]
LinkedIn: gayan-kulatilleke

Rasika Weliwita

Git: weliwita
E-mail: [email protected]
LinkedIn: rasika-weliwita

Milindu Sanoj Kumarage

Git: agentmilindu
Email: [email protected]
LinkedIn: Milindu Sanoj Kumarage
Twitter: @agentmilindu

Suresh Lasantha

Git: lasanthasuresh
Email: [email protected]
Linkedin: suresh-lasantha
Twitter: @lasanthasuresh

Dhammika Marasinghe

Git: dhammika-marasinghe
E-mail: [email protected]
LinkedIn: dhammikamarasinghe
twitter: @Dhammika

Manas Najmuddeen

Git: nmmanas
E-mail: [email protected]
LinkedIn: manasnajmuddeen
Twitter: @nmmanas

mustache.js

jQuery

crud.js's People

Contributors

agentmilindu avatar dhammikamare avatar

Stargazers

tidalbobo avatar

Watchers

Rasika Weliwita avatar James Cloos avatar tidalbobo avatar  avatar Suresh Lasantha avatar Manas Najmuddeen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.