0.28.0 • Published 5 years ago

@guimabdo/webtyped-angular4 v0.28.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Build Status

WebTyped Latest version

WebTyped is a tool for generating strongly typed TypeScript code from your http://ASP.NET or http://ASP.NET/core Web Apis.

Quick Start

npm install @guimabdo/webtyped -g
npm install @guimabdo/webtyped-common

Create a webtyped.json configuration file in your project. Example:

{
	"files": [
		"../Controllers/**/*.cs",
		"../Models/**/*.cs"
	]
}

At the command line, run webtyped:

webtyped

Or use 'watch' option for generating typescript code and start watching cs files:

webtyped watch

Use generated services wherever you want:

import { MyService } from './webtyped/<services-folder>';
import { WebTypedFetchInvoker } from "@guimabdo/webtyped-common";

let inv = new WebTypedFetchInvoker(<api-base-url>);
let myService = new MyService(inv); //Generated from MyController.cs
myService.get().then(result => console.log(result));

Angular

npm install @guimabdo/webtyped-angular

webtyped.json

{
	"files": [
		"../Controllers/**/*.cs",
		"../Models/**/*.cs"
	],
	"inject": {
		"beforeServiceClass": [
			"import { Injectable } from '@angular/core';",
			"@Injectable({ providedIn: 'root' })"
		]
	},
}

Import the generated module and inject services when needed:

app.module.ts

import { WebTypedNgModule } from '@guimabdo/webtyped-angular';
@NgModule({
	imports: [
		WebTypedNgModule.forRoot()
	],
	//Optionally set api base. Default is './'
	providers: [
		{
			provide: 'API_BASE_URL',
			useValue: '<url>'
		}
	]
})
export class AppModule {}

Usage:

some.component.ts (for example)

import { MyService } from './webtyped/<services-folder>';
@Component({...})
export class SomeComponent {
	constructor(myService: MyService){}
}

Requirements

netcore 2.0 on dev machine

0.28.0

5 years ago

0.28.0-dev.156

5 years ago

0.28.0-dev.146

5 years ago

0.28.0-dev.145

5 years ago

0.28.0-dev.144

5 years ago

0.28.0-dev.143

5 years ago

0.28.0-dev.142

5 years ago

0.28.0-dev.141

5 years ago

0.28.0-dev.139

5 years ago

0.27.2

5 years ago

0.27.0

5 years ago

0.27.0-dev.111

5 years ago

0.27.0-dev.110

5 years ago

0.26.0

6 years ago

0.26.0-dev.76

6 years ago

0.26.0-dev.75

6 years ago

0.26.0-dev.49

6 years ago

0.25.0

6 years ago

0.25.0-dev.47

6 years ago

0.25.0-dev.46

6 years ago

0.25.0-dev.45

6 years ago

0.25.0-dev.44

6 years ago

0.25.0-dev.43

6 years ago

0.25.0-dev.42

6 years ago

0.25.0-dev.41

6 years ago

0.25.0-dev.40

6 years ago

0.25.0-dev.39

6 years ago

0.25.0-dev.38

6 years ago

0.25.0-dev.37

6 years ago

0.25.0-dev.36

6 years ago

0.25.0-dev.35

6 years ago

0.25.0-dev.34

6 years ago

0.25.0-dev.33

6 years ago

0.25.0-dev.32

6 years ago

0.25.0-dev.31

6 years ago

0.25.0-dev.30

6 years ago

0.0.0

6 years ago