https://github.com/hangxingliu/node-verb-uri
A verb URI parse and stringify Node.js module
https://github.com/hangxingliu/node-verb-uri
http nodejs parser stringify uri
Last synced: 5 months ago
JSON representation
A verb URI parse and stringify Node.js module
- Host: GitHub
- URL: https://github.com/hangxingliu/node-verb-uri
- Owner: hangxingliu
- License: gpl-3.0
- Created: 2018-05-06T02:52:47.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-07T01:02:42.000Z (almost 8 years ago)
- Last Synced: 2025-10-12T17:15:46.897Z (6 months ago)
- Topics: http, nodejs, parser, stringify, uri
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# verb-uri
[](https://travis-ci.org/hangxingliu/node-verb-uri)
A verb URI parse and stringify Node.js module
## Install
``` bash
npm install verb-uri
```
## Example
[example/index.js](example/index.js)
``` javascript
const verbURI = require('verb-uri');
console.log(verbURI.parse('POST /api/book')); // { verb: 'POST', uri: '/api/book' }
console.log(verbURI.parse('/api/books')); // { verb: 'GET', uri: '/api/books' }
console.log(verbURI.parse('/api/books', { defaultVerb: 'POST' })); // { verb: 'POST', uri: '/api/books' }
console.log(verbURI.stringify('post', '/api/book')); // 'POST /api/book'
console.log(verbURI.stringify('post', '/api/book', { keepCase: true })); // 'post /api/book'
console.log(verbURI.stringify(null, '/api/books')); // 'GET /api/book'
```
## Author
[Liu Yue](https://github.com/hangxingliu)
## License
[GPL-3.0](LICENSE)