ccd-ng2
v1.0.5
Published
Class based web framework on top of Express that uses async await operators to simplify the controllers logic and promote writing clean, simple and maintainable web server
Downloads
8
Readme
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);
}
}