Skip to content

Instantly share code, notes, and snippets.

@4skinSkywalker
Last active March 28, 2019 10:28
Show Gist options
  • Save 4skinSkywalker/a3c350d3959ad43a7a4755809c792e1d to your computer and use it in GitHub Desktop.
Save 4skinSkywalker/a3c350d3959ad43a7a4755809c792e1d to your computer and use it in GitHub Desktop.
import { InMemoryDbService } from 'angular-in-memory-web-api';
import { RequestInfo } from 'angular-in-memory-web-api/interfaces';
export class MyInMemoryService implements InMemoryDbService {
// In-Memory DB will intercept /api/whatever calls and return data
createDb() {
const customers = [
{ id: 1, username: 'fred92', password: '1234' },
{ id: 2, username: 'john69', password: 'abcd' },
// add as many data you need
]
const products = [
{ id: 1, maker: 'Samsung', model: 'Galaxy'},
{ id: 2, maker: 'Sony', model: 'Xperia'}
]
return { customers, products } // add as many end-points you want
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment