8000 GitHub - codechem/ccd-ng2
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

codechem/ccd-ng2

Repository files navigation

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);
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published
0