1.0.4-alpha • Published 6 years ago

lasagne v1.0.4-alpha

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Lasagne Build Status

Easy way to mock api locally

Installation

You can install lasagne from npm with yarn:

yarn add lasagne

Or with npm:

npm i lasagne

Core concept and usage

Lasagne was created for make work without api more standartized and allow to make easy switch between remote api and local api layers.

import { lasagne, registerLayer } from 'lasagne'

const root = {
  '/': () => ({ foo: 'bar' }),
  '/item': ({ id }) => {
    return localStorage.getItem(`test-storage-${id}`)
  }
}

registerLayer('root', root)

;(async () => {
  const res = await lasagne('/') // { foo: bar }
  const item = await lasagne('/item', { id: 1 }) // ...
})

Then we can replace lasagne with fetch or something else to work with remote api layer.

Roadmap

  • Make allow to mock fetch and other libs for more flexability
1.0.4-alpha

6 years ago

1.0.2-alpha

6 years ago

1.0.1-alpha

6 years ago

1.0.0-alpha

6 years ago