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

0.0.24 • 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 '@ramonornela/url-resolver';

export const APP_ROUTE = {
  '_defaults': {
    'host': 'http://api.example.com/'
  },
  'user': {
    'url': 'user/{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 {}

Contributing

See CONTRIBUTING.md

Package Sidebar

Install

npm i @ramonornela/url-resolver

Weekly Downloads

1

Version

0.0.24

License

MIT

Last publish

Collaborators

  • ramonornela