Skip to content

Commit

Permalink
Merge pull request #1 from nobrainr/feat/api-surface
Browse files Browse the repository at this point in the history
Feat/api surface
  • Loading branch information
emyann authored Nov 15, 2018
2 parents fcb7955 + faf4f37 commit 934991f
Show file tree
Hide file tree
Showing 13 changed files with 5,649 additions and 276 deletions.
58 changes: 58 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
test-job:
docker:
- image: circleci/node:8-browsers
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# run tests!
- run:
name: Run Tests
command: npm test

publish-job:
docker:
- image: circleci/node:9
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Build
command: npm run build:prod
- run:
name: Publish Package
command: cd dist && npm run semantic-release

workflows:
version: 2
test:
jobs:
- test-job
- publish-job:
requires:
- test-job
filters:
branches:
only:
- master
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node_modules
node_modules
**/coverage/**/*
.DS_STORE
dist
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# axios-morphism

## Getting started

### Installation

```sh

npm install --save axios-morphism

```

### Example

```typescript
import { apply, AxiosMorphismConfiguration } from './axios-morphism';

const peopleSchema = { name: 'name', firstName: 'firstName' };

const configuration: AxiosMorphismConfiguration = {
url: 'https://api.com',
interceptors: {
responses: [{ matcher: '/people/:id', schema: peopleSchema }]
}
};

apply(client, configuration);
await client.get(`https://api.com/people/1`);

// {
// name: 'Smith',
// firstName: 'John'
// }
```

## License

MIT © [Yann Renaudin][twitter-account]

[twitter-account]: https://twitter.com/renaudin_yann
Loading

0 comments on commit 934991f

Please sign in to comment.