ccd-ng2
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

Build Status

CCD-NG2

Provides @ngGenSvc decorator that generates angular2 services for a given CCController

Example

@ngSvcGen('./client/svc', true)
class HelloCtrl extends CCController{
    @get('/hello/:name')    
    helloWorld(req, res){
        return `hello ${req.params.name}`
    }

    @post('/:id')    
    doSomething(req, res){
        return ....
    }
    ...
}

Output in ./client/svc:

import { Injectable } from '@angular/core';
import { SimpleRestService } from 'ccNgRest';

@Injectable()
export class HelloCtrlSvc{
    constructor(private rest: SimpleRestService){}

    helloWorld(name){
        return this.rest.get('/hello/'+name);
    }

    doSomething(id, payload){
        return this.rest.post('/'+id, payload);
    }
}

Package Sidebar

Install

npm i ccd-ng2

Weekly Downloads

4

Version

1.0.5

License

ISC

Last publish

Collaborators

  • stefan.popovski
  • iboshkov
  • ccadm