@stefanini/url-resolver
TypeScript icon, indicating that this package has built-in type declarations

4.0.1 • Public • Published

UrlResolverModule

This allow define configuration of objects request

Using HttpModule in an Ionic 2 app

import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';

// import url-resolver module
import { UrlResolverModule } from '@stefanini/url-resolver';

export const APP_ROUTE = {
  '_defaults': {
    'host': 'http://api.example.com/'
  },
  'user': {
    'url': 'users/{id}',
    'method': 'GET',
    'headers': {
      'content-type': 'application/json'
    },
    'params': {
      'id': {
        'type': 'number',
        'required': true
      }
    }
  }
};

@NgModule({
  declarations: [
    MyApp
  ],
  imports: [
    IonicModule.forRoot(MyApp),
    UrlResolverModule.initialize(APP_ROUTE),
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp
  ]
})
export class AppModule {}

Dependents (0)

Package Sidebar

Install

npm i @stefanini/url-resolver

Weekly Downloads

0

Version

4.0.1

License

MIT

Unpacked Size

96.7 kB

Total Files

68

Last publish

Collaborators

  • stefanini