Giter VIP home page Giter VIP logo

in-memory-web-api's Issues

Any plan to support pagination?

Currently /api/models returns the whole collection by default, is there any plan to support pagination via something like /api/models?start=100&limit=50, while start and limit can be customized via InMemoryBackendConfig?

Error after updating to 0.1.12

I got this error after updating to 0.1.12.

Failed to load resource: the server responded with a status of 404 (Not Found)
Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/traceur
    Error: XHR error (404 Not Found) loading http://localhost:3000/traceur
        at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:698:29)
        at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:265:35)
        at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:154:47)
        at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:335:33)
    Error loading http://localhost:3000/traceur
    Unable to load transpiler to transpile http://localhost:3000/node_modules/angular-in-memory-web-api/index.js
    Error loading http://localhost:3000/node_modules/angular-in-memory-web-api/index.js as "angular-in-memory-web-api" from http://localhost:3000/app/app.module.js
        at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:698:29)
        at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:265:35)
        at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:154:47)
        at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:335:33)
    Error loading http://localhost:3000/traceur
    Unable to load transpiler to transpile http://localhost:3000/node_modules/angular-in-memory-web-api/index.js
    Error loading http://localhost:3000/node_modules/angular-in-memory-web-api/index.js as "angular-in-memory-web-api" from http://localhost:3000/app/app.module.js

We also tried it in angular.io quickstart but got the same error.

The application works with the older versions(0.1.9 and 0.1.10) without any errors.

Please let us know if you need something else.

angular-in-memory-web-api/index.js does not export InMemoryWebApiModule

I started new project with current ionic2rc0, get the following error:

Error: Module ./node_modules/angular-in-memory-web-api/index.js does not export InMemoryWebApiModule (imported by ./.tmp/app/app.module.js)

ionic info

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
OS: Distributor ID: LinuxMint Description:  Linux Mint 17.3 Rosa 
Node Version: v6.7.0

npm list -depth=0

├── @ionic/[email protected]
├── @ionic/[email protected]
├── [email protected] extraneous
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Any ideas? Or is it a specific ionic problem? Thank you!

angular2 in-memory-web-api only for a part of an application

I was wondering if is possible to configure angular2 in-memory-web-api only for a part of an application. I want to reach external endpoints for finished components and use in-memory-web-api for components in development stage.

I've tried to do this in the folowing two ways:

1 - Loading the data in the main and changing the XHRBackend in the components that I want to reach in-memory endpoints;

main.ts

bootstrap(AppComponent, [
    ...
    { provide: SEED_DATA, useClass: InMemoryDataService }
]);

inDevelopmentStage.service.ts

@Component({
    providers: [
        { provide: XHRBackend, useClass: InMemoryBackendService }
    ]
})

2 - Loading the data and changing the XHRBackend in the components that I want to reach in-memory endpoints;

inDevelopmentStage.service.ts

@Component({
    providers: [
        { provide: XHRBackend, useClass: InMemoryBackendService }, // in-mem server
        { provide: SEED_DATA, useClass: InMemoryDataService }      // in-mem server data
    ]
})

Is there any way that I can achieve this goal?

Thanks for your help!

From angular2-in-memory-web-api to angular-in-memory-web-api

I have a angular-cli bootstrapped project. I had angular2-in-memory-web-api, everything was working as expected. Then i decided to upgrade and use the newest version angular-in-memory-web-api but unfortunately i get the following error (basically my api route /api/whatever does not exist)

image

Any suggestions? and any reason why this upgrade is braking?

How to use unknown url with the same collection name?

I have added a passThruUnknownUrl: true config in this way:
InMemoryWebApiModule.forRoot(InMemoryDataService, { passThruUnknownUrl: true })

And chang
private heroesUrl = 'api/heroes';
to
private heroesUrl = 'https://58ac43fef989751200f99333.mockapi.io/v1/heroes/';

But app still loads heroes from in-memory api.

P/s: When I add one more slash before 'heroes' this way:
private heroesUrl = 'https://58ac43fef989751200f99333.mockapi.io/v1//heroes/';
(as a result link have one more level)
App loads heroes from remote API.

Plunker demo (modified last part TourOfHeroes)

Url to get data

Hi!
I want to use in app url's like /api/v1/heroes. How to do this?

Need for hitting in-memory-web-api and external endpoints

I need to be able to continue using in-memory-web-api to serve mock data in development, while at the same time hit external endpoints in production without much change except for the urls. ( This is a slight variation of #15 where in-memory-web-api is registered in AppModule itself. )

Basically I need to be able to use 2 services, one which points to the url, 'app/mock_data' and 'api.server.com/mock_data' and swap between these two in development and production.

But currently, I'm not able to do this because I have to comment out the InMemoryWebApiModule.forRoot(MockData) everytime I have to hit an external endpoint and I can't find any way to conditionally load that in the AppModule imports based on the mode.

Now, I have seen that line in the documentation which says "swap in-memory-web-api out when you have a real api", but I don't wanna do that - because I need the front-end developers to be able to go on with their work without the need to setup of a local api.

Downloading for use in Ionic 2 - No tsconfig.json, tslint.json, typings.json installed

Hi, I am totally new to Ionic 2 and Angular 2. Wanted to use the in-memory-web-api in my Ionic 2 app but am facing problems.

When I install the package with "npm i angular-in-memory-web-api --save" I see it in the node-modules folder but in the angular-in-memory-web-api folder there is no tsconfig.json, tslint.json and typings.json.

What can/shall I do?

Get nested property of a collection

Hi,
If I understand correctly, while using Angular 2 and this great tool I can only ask for a collection and ID on put, right?
It must be app/[COLLECTIONNAME]/ID. What If my real put request only returns an array of strings and I don't have an id in the schema?
For example I have this collection:

myCollection:  
   {
     store: 
           {items: ['item1', 'items2','item3']}
   }

Can it be more flexible?
How can I update items with put by using in-memory-web-api?
The need for id is somewhat limiting IMO.
Thanks.

Support for custom / composite keys and how they map to urls

in-memory-web-api is great but I would like some my control over how urls are translated to instances of a data array. For instance, given a url like this "/app/modules/1/instances/2" I would like in-memory-web-api to map to the shown extract of an array passed to createDb.

Notice that the data effectively has a composite key of moduleId + moduleInstanceId and does not have an id property. All of which is not well supported by in-memory-web-api right now.

[
 { // Module 1, Instance 2 here:
      moduleId: "1",
      moduleInstanceId: "2",
     ... 
  },
 ...
]

InMemoryBackendService class should <T>

IMHO then we can do this do the class:

protected findById(collection: T[], id: number | string): T;
protected genId(collection: T): T;
protected indexOf(collection: T[], id: number): number;
protected parseId(collection: {id: T;}[], id: string): T;
protected removeById(collection: T[], id: number): boolean;

I can make all these changes and send it off in a PR, but writing this issue to see if you'd want/accept that.

Parse error with URL like 'response.json'

Asking for URL like response.json will cause error. I tracked down this error to a parseUrl
function of InMemoryBackendService. The problem is, that the collectionName gets seen as base, and the collectionName then is empty, and it throws.

I tried to add slash before the URL, but it ends up with same result.

export class InMemoryDataService implements InMemoryDbService {
    createDb() {
        let response= {
            prop: 'string',
            ...
        }
        return {
            'response.json': response
        }
    }
}

Issue Multiple Services usage

imports: [
  ...
  InMemoryWebApiModule.forRoot(Service1), // "app/service1"
  InMemoryWebApiModule.forRoot(Service2) // "app/service2"
]

When in-memory-web-api is used for multiple services like this, only the last service url(not checked with more than 3, so I dunno if "last" is always true) is available. I confirmed it by switching places of service1 and service2.

Uncaught TypeError: ctorParameters.map is not a function

I followed the example for setting up the in-memory-web-api and I get the following error

reflection_capabilities.js:58 Uncaught TypeError: ctorParameters.map is not a function.

This occurred right after I added the following import line to my app.module.ts

InMemoryWebApiModule.forRoot(InMemoryDataService)

Imports in Webpack

Using https://github.com/johnpapa/event-view as a guide, I've tried implementing this in my project which uses webpack. However the import statement doesn't work

import {
  InMemoryBackendConfig,
  InMemoryBackendService,
  SEED_DATA
} from 'angular2-in-memory-web-api/core';

Console Output
bootstrap d05bac4…:50 Uncaught ReferenceError: System is not defined

The offending line is https://github.com/angular/in-memory-web-api/blob/master/core.js#L1

The workaround for webpack is just to use the import from 'angular2-in-memory-web-api/src/core'.

It might be worth changing this to be consistent with most other ng2/typescript libraries.

doubt

why should i use this in-memory-web-api

[Suggestion] - change rootPath in InMemoryBackendConfigArgs to be array of paths

Use case:

Api is scoped so scope is part of rootPath.

/api/v2/auth/users
/api/v2/auth/oauth

/api/v2/carparts/wheels
/api/v2/carparts/dors
/api/v2/carparts/keys

rootPath = /api/v2/carparts
collections = {wheels, dors, keys}

Web Api is configured on CarPartsModule.

All calls to /api/v2/auth will passTrough if it is configured.

If we have multiple rootPaths we can mock calls outside of current scope - here carparts.

Cons:
it is possible to have same named endpoints(collections) across scopes:

/api/v2/carparts/keys
/api/v2/security/keys

Unexpected behavior due to bad handling of overridden responseInterceptor

If the InMemoryDbService class has a responseInterceptor function, InMemoryBackendService currently copies that function to its own responseInterceptor variable, and then uses that variable to call the function while processing requests.

This leads to unexpected behavior, because the function gets executed with the this variable set to the InMemoryBackendService instead of the InMemoryDbService (verify by calling console.log(this) from your responseInterceptor). Any code that uses this inside the overridden responseInterceptor to reference other variables or functions in the InMemoryDbService class will fail.

Mention import ordering in documentation

Maybe this is basic Angular stuff we should know, but I think it would still be beneficial to add it to the docs. I was banging my head for a day and half trying to figure out why the in-memory backend wasn't being used.

My initial configuration was like

@NgModule({
  imports: [
    InMemoryWebApiModule.forRoot(...),
    CoreModule.forRoot(),    // imports HttpModule
    // Material 2
    MdIconModule.forRoot(),  // also imports HttpModule -> I DIDN'T KNOW!!
})
class AppModule {}

It seems this ordering will cause the last added HttpModule (with the default XHRBackend) to be used instead of the InMemoryBackendService. Changing the order to have the InMemoryWebApiModule last did the trick.

I think it should be mentioned in the docs that we should make sure to place the module last, just in case.

how to intercept http invocations from services loaded from lazy/feature modules

I have InMemoryWebApiModule added into AppModule/CoreModule. now it is able to intercept http invocations from services loaded in AppModule/CoreModule but not from services in lazy loaded, feature modules.

AppModule/CoreModule

 InMemoryWebApiModule.forRoot(InMemoryDataService, {
      passThruUnknownUrl: true
 }),

I have SharedModule that I import in multiple other feature modules.
I understand lazy loaded modules will have different dependency injector. But my question is how to share same InMemoryDataService for CoreModule and all feature modules without duplicating code?

would like to have forChild option like in ngx-translate

Map file lookup fails

The output .js files have references to .js.map files that are not being checked into the repo. This is throwing warnings when trying to consume the module.

Provide a reference to InMemoryBackendService on function overrides

If a method of the InMemoryBackendService is overridden, such as get. In the arguments to the function provide a way to to invoke the InMemoryBackendService collectionHandler.

This will allow overridden methods the contain logic whether to return their own Observer<Response> or defer to the InMemoryBackendService.

This is a terrible representation of what I'm suggesting, but hopefully it gets the point across.

Within handleRequest

try {
      if ('commands' === reqInfo.base.toLowerCase()) {
        return this.commands(reqInfo);

      } else if (this.inMemDbService[reqMethodName]) {
          // omitted for brevity 
        return this.inMemDbService[reqMethodName]({ 
                ...interceptorArgs,
                defaultHandler: this.defaultResponseHandler
         });
      } else {
         this.defaultResponseHandler();
      }    

Perhaps there's a better approach. Currently, I do not see a way of intercepting the get and conditionally providing a response.

[Suggestion] Allow response configuration

An option to change response type would be a nice addition. Example:
The HTTP spec recommends returning 204 on PUT, as you've implemented. But in practice this recommendation is far from ideal, as it requires another GET request in order to access the processed entity. Now, while I'm all for simple and clean, this is too much. Very few implement this by the spec, especially because having the updated entity in the PUT request response won't break anything.

Error due to reference to types core-js

Hello,

I'm working on the tour of heroes, implementing it with the AngularCLI and the last version of angular (2.1.0) => https://github.com/davinkevin/Angular2-TourOfHeroes.

So, at the part6 of the TourOfHeroes, I install the in-memory-web-api, but after serving the app I am facing the following error :

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/angular-in-memory-web-api/in-memory-backend.service.d.ts:1:0
Cannot find type definition file for 'core-js'.

The line 1 of the file https://github.com/angular/in-memory-web-api/blob/master/in-memory-backend.service.d.ts#L1 try to load the type file for core-js, but it is only a dev dependency, so not present in my project.

If I add this by installing with npm i -D @types/core-js I have a lot more errors, due to conflicts with es2015.core types definition of Typescript.

** NG Live Development Server is running on http://localhost:4200. **
4569ms building modules
34ms sealing
0ms optimizing
0ms basic module optimization
78ms module optimization
1ms advanced module optimization
12ms basic chunk optimization
0ms chunk optimization
3ms advanced chunk optimization
1ms module and chunk tree optimization
127ms module reviving
9ms module order optimization
4ms module id optimization
3ms chunk reviving
0ms chunk order optimization
11ms chunk id optimization
59ms hashing
0ms module assets processing
165ms chunk assets processing
3ms additional chunk assets processing
0ms recording
0ms additional asset processing
1341ms chunk asset optimization
1050ms asset optimization
42ms emitting
Hash: 0f90a2d2ddfcb98dd1e0
Version: webpack 2.1.0-beta.25
Time: 7531ms
           Asset       Size  Chunks             Chunk Names
  main.bundle.js    3.09 MB    0, 2  [emitted]  main
styles.bundle.js    10.7 kB    1, 2  [emitted]  styles
       inline.js    5.53 kB       2  [emitted]  inline
        main.map    3.21 MB    0, 2  [emitted]  main
      styles.map    14.8 kB    1, 2  [emitted]  styles
      inline.map    5.59 kB       2  [emitted]  inline
      index.html  485 bytes          [emitted]

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:21:13
Duplicate identifier 'PropertyKey'.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:85:4
All declarations of 'name' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:145:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:262:4
All declarations of 'flags' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:276:4
All declarations of 'EPSILON' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:311:4
All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:318:4
All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:457:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:457:4
All declarations of '[Symbol.toStringTag]' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:464:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:492:4
All declarations of 'hasInstance' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:498:4
All declarations of 'isConcatSpreadable' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:504:4
All declarations of 'iterator' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:510:4
All declarations of 'match' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:516:4
All declarations of 'replace' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:522:4
All declarations of 'search' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:528:4
All declarations of 'species' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:534:4
All declarations of 'split' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:540:4
All declarations of 'toPrimitive' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:546:4
All declarations of 'toStringTag' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:552:4
All declarations of 'unscopables' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:609:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Math"', but here has type 'string'.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:609:4
All declarations of '[Symbol.toStringTag]' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:613:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"JSON"', but here has type 'string'.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:613:4
All declarations of '[Symbol.toStringTag]' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:628:4
All declarations of 'size' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:634:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:645:4
All declarations of 'size' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:651:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:666:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:680:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:692:4
All declarations of 'value' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:804:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/typescript/lib/lib.es2015.core.d.ts:17:13
Duplicate identifier 'PropertyKey'.
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  2.82 kB       0
webpack: bundle is now VALID.

What can we do to suppress this error ?

Thanks ;)

Strange lint warnings about missing C:/github/angular.in-memory-web-api/src//src/index.ts

If I switch to this new in-memory-web-api library, I get a strange lint warning when running "ng test" on my mac:

WARNING in ./~/angular-in-memory-web-api/index.js
Cannot find source file 'C:/github/angular.in-memory-web-api/src//src/index.ts': Error: Can't resolve './C:/github/angular.in-memory-web-api/src//src/index.ts' in '/Users/xxx/mytestproject/node_modules/angular-in-memory-web-api'
 @ ./src/app/shared/services/test.service.spec.ts 6:34-70
 @ ./src \.spec\.ts
 @ ./src/test.ts

The source file that it can not find is "C:/github/angular.in-memory-web-api/src//src/index.ts" and is unrelated to my project and even my platform (I am using Mac - not windows).

API Change: More control over request/response shape

Thanks for the library, it's really handy.

I have a few suggestions for the API. Currently you have to use the /app endpoint with the name of the collection, which then responds with { data: yourCollection}. This has meant i've had to change my actual http contracts to just use a mocked api.

What about modifying the API to look something like this?

export class InMemoryStoreService {
  createEndpoints() {
     return [
       { match: 'api/v1/events', responsebody: { events: [ { id: 1, foo: 'bar'}]} }
     ]
  }
}

This would satisfy my initial needs, but eventually it could be expanded to satisfy more complicated scenarios with proper routing, parameters, headers etc.

Not sure if this is beyond the scope of this project, however I think the above suggestion would at least allow users of this library to not drastically modify their http contracts when building an app that will later call a real API.

Thoughts?

0 cannot be used as an id

Because several checks in the code use !id as the check, a value of 0 comes back as a falsy value, thus breaking things. It seems to me that an id with value 0 should be valid. I believe there are three locations in code that would be needed to fix this. I happened to run into it with a post and a delete.

As a test, simply set the db to an initial value of:
[
{
"id": 0,
"otherdata": "my value"
},
{
"id": 1,
"otherdata": "my other value"
}
]

Then, try to do a post or delete of the item with id 0.

Put doesn't work

HTTP PUT doesn't work, the server returns 400. As designed? Or should I set the url http://hostname/collectionname/id manually?

Not assigning returned API data to `data` property?

There does not seem to be a simple way to override the data property of returned API data. My API doesn't wrap the returned data in a object property in this way.

I could use overrides but that seems more involved than necessary for such a minor change, or is it? Maybe I'm just misunderstanding this.

[Feature Request] Support for nested resources

As best I can tell, there's currently no support for nested resources. Nested resources are relatively common in the REST APIs I've used. For example, I might have an API that provides banking account information by exposing the resource endpoints shown below.

https://myservice.com/accounts
https://myservice.com/accounts/1/transactions

The first is a top-level resource that retrieves basic information for all accounts. The second is a nested resource that retrieves transaction details for a specific account. I don't believe there's a way to support this second, nested resource using the in-memory-web-api.

I would be glad to work up a Pull Request if you're interested in adding this feature. I've overridden parseUrl in my app to identify fully qualified collection names for nested resources. For example, parsing a request to the transactions endpoint shown above would result in a collection name of 'accounts/1/transactions'. The hash I return from `createDb' then must contain a collection key of the same name.

Wrong license in package.json

package.json states

"license": "ISC",

while license file says it is MIT like all other angular packages. Creates errors on automatic license parsers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.