node package manager

echo-crud

ECHO-CRUD

Restful with mongodb + koa ❤️

Pdta: ECHO (Elian Chancay Olivo is my Son 👶 It's funny because I do not like php )

Developing ... 🏃

version downloads slack


NPM


How to use

 
  import koa          from 'koa';
  import mongoose     from 'mongoose';
  import echoApi      from 'echo-crud';
 
  const app = koa();
  const mongoUrl = 'mongodb://localhost/yourDatabase';
 
  mongoose.connect(mongoUrl);
 
  let schema = new mongoose.Schema({
    name: String,
    age : Number
  }, {versionKey: false});
 
  const model = app.model = mongoose.model('user', schema);
  const user = echoApi(app, model,['GET','POST','PUT','DELETE']);
 
  app.use(user.routes());
 
  app.listen(3000);
 

Use header X-Requested-With : XMLHttpRequest

test in your browser. http://localhost:3000/users

-- Params query body
GET limit - skip - sort ---
GET id limit - skip - sort ---
POST --- --- Json data
DELETE id* --- ---
PUT id* --- Json data

Bitdeli Badge