Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paul-soporan/stackexchange-api
A Node.js wrapper for the StackExchange API
https://github.com/paul-soporan/stackexchange-api
api nodejs stackexchange-api wrapper
Last synced: 2 months ago
JSON representation
A Node.js wrapper for the StackExchange API
- Host: GitHub
- URL: https://github.com/paul-soporan/stackexchange-api
- Owner: paul-soporan
- License: mit
- Created: 2019-10-19T13:19:54.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-11T15:40:37.000Z (over 3 years ago)
- Last Synced: 2024-10-19T22:58:40.800Z (3 months ago)
- Topics: api, nodejs, stackexchange-api, wrapper
- Language: TypeScript
- Homepage:
- Size: 883 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# stackexchange-api
[![npm](https://img.shields.io/npm/v/stackexchange-api)](https://www.npmjs.com/package/stackexchange-api)
[![CircleCI](https://img.shields.io/circleci/build/gh/paul-soporan/stackexchange-api)](https://circleci.com/gh/paul-soporan/stackexchange-api)
[![npm](https://img.shields.io/npm/dw/stackexchange-api)](https://www.npmjs.com/package/stackexchange-api)
[![NPM](https://img.shields.io/npm/l/stackexchange-api)](https://github.com/paul-soporan/stackexchange-api/blob/master/LICENSE.md)
[![GitHub issues](https://img.shields.io/github/issues/paul-soporan/stackexchange-api)](https://github.com/paul-soporan/stackexchange-api/issues?q=is%3Aissue+is%3Aopen)*A Node.js wrapper for the StackExchange API*
**[Documentation](https://paul-soporan.github.io/stackexchange-api/)**
**Disclaimer: WIP. Doesn't work with many endpoints yet.**
## Features:
* stackexchange-api provides a simple way to access the StackExchange API endpoints
* All complex data types from the API have a corresponding Object
* stackexchange-api is written in TypeScript and every field of every request option / result has (*will eventually have*) type definitions. As a result, modern editors are able to provide extensive autocompletion.## Installation
### Using npm:
`npm install --save stackexchange-api`#### Using yarn:
`yarn add stackexchange-api`## Usage
**Including in a project:**
* ES6:
```js
import {StackExchange} from 'stackexchange-api';
```* CommonJS:
```js
const StackExchangeApi = require('stackexchange-api');
```**Example usage:**
```js
import {StackExchange} from 'stackexchange-api';
StackExchange.search({ // Equivalent to the /search endpoint. Go to https://paul-soporan.github.io/stackexchange-api/classes/stackexchange.html#search for details.
inTitle: 'nodejs',
site: 'stackoverflow'
}).then((result) => {
console.log(result);
// Output: Wrapper
console.log(result.items);
// Output: an array of Questions (Question[])
console.log(result.items[0]);
// Output: the first Question
console.log(result.items[0].viewCount);
// Output: the view count of the first Question
});
```