Skip to content

Commit

Permalink
Merge pull request #1 from nikksan/main
Browse files Browse the repository at this point in the history
Initial implementation
  • Loading branch information
tecs committed Jan 13, 2021
2 parents 7211a78 + 29c83e3 commit 3a159d3
Show file tree
Hide file tree
Showing 19 changed files with 7,043 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { backendTs } = require('@luckbox/eslint-rules');

module.exports = backendTs;
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea/
node_modules/
.eslintcache
dist/
coverage/
.vscode/
tsconfig.tsbuildinfo
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
src/
examples/
.eslintrc.js
tsconfig.json
.gitignore
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: node_js
cache: npm
node_js:
- "stable"

install:
- npm install
- npm run build

script:
- npm run test
- npm run coveralls
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
# http-adapter-factory
[![Build Status](https://travis-ci.org/LuckboxGG/http-adapter-factory.svg?branch=main)](https://travis-ci.org/LuckboxGG/http-adapter-factory)

[![Coverage Status](https://coveralls.io/repos/github/LuckboxGG/http-adapter-factory/badge.svg?branch=main)](https://coveralls.io/github/LuckboxGG/http-adapter-factory?branch=main)

# Http Adapter Factory

A factory producing http adapters with different(in the near future) underlying library implementations.

### Usage

```
import HttpAdapterFactory from '@luckbox/http-adapter-factory';
const httpAdapterFactory = new HttpAdapterFactory();
const httpAdapter = httpAdapterFactory.create({
timeout: 10000
});
/* ... */
await httpAdapter.get('http://example.com', { bar: 'foo '});
await httpAdapter.post('http://example.com', {
email: 'user@exampke.com',
password: '123456'
});
```

## Supported implementations:

Currently, only one request library is supported - [got](https://github.com/sindresorhus/got#readme)



8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
roots: ['<rootDir>/src'],
transform: {
'^.+\\.ts$': 'ts-jest',
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.ts$',
moduleFileExtensions: ['ts', 'js'],
}
Loading

0 comments on commit 3a159d3

Please sign in to comment.