Skip to content

Commit

Permalink
Update Repo + Add Html Parser (#134)
Browse files Browse the repository at this point in the history
* use const/let over var --ES+ features πŸ™ŒπŸ» ..

* update example.js --better ✨ ..

* update test file by add --spec πŸ§ͺ..

* avoid generating package-lock.json β˜”οΈ ..

* update .gitignore file 🐞 ..

* lint files πŸ’…πŸ» ..

* update README.md πŸ“‹ ..

* update README.md πŸ“‹ ..

* add huskyrc --git --hooks 🐺 ..

* update travis ci pipeline πŸ‘¨πŸΌβ€πŸ”§ ..

* add code for parse html πŸ“Œ ..

* add test for parse html πŸ§ͺ..

* better pkg.json πŸŽ— ..
  • Loading branch information
3imed-jaberi committed Apr 17, 2020
1 parent ecc6ebf commit afecb1a
Show file tree
Hide file tree
Showing 13 changed files with 566 additions and 623 deletions.
34 changes: 20 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
# OS #
###################
.DS_Store
.idea
Thumbs.db
tmp/
temp/

pids
logs
results

npm-debug.log
# Node.js #
###################
node_modules
coverage/
package-lock.json
yarn.lock
npm-debug.log
yarn-debug.log
yarn-error.log


.idea/
# NYC #
###################
coverage
*.lcov
.nyc_output
5 changes: 5 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hooks": {
"pre-commit": "npm run lint"
}
}
4 changes: 0 additions & 4 deletions .jshintignore

This file was deleted.

95 changes: 0 additions & 95 deletions .jshintrc

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
language: node_js
node_js:
- "8"
- "10"
script: "make test-travis"
after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls"
- 8
- 10
- 12
- stable
script:
- npm run test-ci
after_script:
- npm install coveralls
- cat ./coverage/lcov.info | coveralls
45 changes: 0 additions & 45 deletions Makefile

This file was deleted.

20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
koa-bodyparser
===============
# [**koa-bodyparser**](https://github.com/koajs/bodyparser)


[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Coveralls][coveralls-image]][coveralls-url]
[![David deps][david-image]][david-url]
[![node version][node-image]][node-url]
[![Gittip][gittip-image]][gittip-url]

[npm-image]: https://img.shields.io/npm/v/koa-bodyparser.svg?style=flat-square
[npm-url]: https://npmjs.com/package/koa-bodyparser
Expand All @@ -16,11 +15,8 @@ koa-bodyparser
[coveralls-url]: https://coveralls.io/r/koajs/bodyparser?branch=master
[david-image]: https://img.shields.io/david/koajs/bodyparser.svg?style=flat-square
[david-url]: https://david-dm.org/koajs/bodyparser
[node-image]: https://img.shields.io/badge/node.js-%3E=_7.6-green.svg?style=flat-square
[node-image]: https://img.shields.io/badge/node.js-%3E=_8-green.svg?style=flat-square
[node-url]: http://nodejs.org/download/
[gittip-image]: https://img.shields.io/gittip/dead-horse.svg?style=flat-square
[gittip-url]: https://www.gittip.com/dead-horse/


A body parser for koa, based on [co-body](https://github.com/tj/co-body). support `json`, `form` and `text` type body.

Expand All @@ -33,10 +29,10 @@ A body parser for koa, based on [co-body](https://github.com/tj/co-body). suppor
## Usage

```js
var Koa = require('koa');
var bodyParser = require('koa-bodyparser');
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');

var app = new Koa();
const app = new Koa();
app.use(bodyParser());

app.use(async ctx => {
Expand Down Expand Up @@ -110,6 +106,6 @@ To use `koa-bodyparser` with koa@1, please use [bodyparser 2.x](https://github.c
npm install koa-bodyparser@2 --save
```

## Licences

#### Licences
---
[MIT](LICENSE)
14 changes: 9 additions & 5 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
var koa = require('koa');
var bodyParser = require('./');
const Koa = require('koa');
const bodyParser = require('.');

var app = koa();
const app = new Koa();
app.use(bodyParser());

app.use(function *() {
app.use(async function() {
// the parsed body will store in this.request.body
this.body = this.request.body;
});

app.listen(3000);
const PORT = process.env.PORT || 3000;

app.listen(PORT, () =>
console.log(`Server ready at http://localhost:${PORT} πŸš€ ..`)
);
Loading

0 comments on commit afecb1a

Please sign in to comment.