question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Allow installation via `npm` for use in NodeJS services

See original GitHub issue

Firstly, thanks for the amazing API.

I see that this package is already available via the npm registry and can be installed through npm. However, it looks like it’s primarily optimized for running your own instance of the REST API server. I’m wondering if I could request the ability to install this package as an on-demand utility for making requests for OW stats instead. My use case is to use this package inside a Discord bot, so I have no need to run a standalone srv service with the API. I just need to make on-demand requests to the Overwatch stats from time to time.

My expectation is that I would be able to:

  • npm install overwatch-api
  • Then import it into NodeJS service as import OverwatchAPI from 'overwatch-api'
  • Then use either the profile or stats parsers directly via
  • OverwatchAPI.profile('us', 'pc', 'sometag-123', (response) => { console.log(response); })

However, at the moment there are a few issues preventing me from using this package this way:

  • The package is written with ES6 modules and cannot be easily imported as needed above. In order for this to work, you’d need to add a prepublish script to generate CommonJS modules in the output before publishing the package on npm.
  • There is no index.js file that exports all the available parser utility functions.
  • The main and module keys in package.json aren’t setup correctly

If you don’t object to this, I’d be happy to create a pull request with the needed changes.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
EvHauscommented, May 14, 2018

Ah, my bad! I completely missed the new API docs. It works great. Thank you so much!

0reactions
alfgcommented, May 14, 2018

Right, currently I’m publishing the root as overwatch-api-server, and the client within api/package.json as overwatch-api to be the client api as two separate packages. Is that different from what you are saying?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature request: node --install · Issue #11835 - GitHub
I am not suggesting that Node.js stop shipping with npm by default. I am not suggesting that the Node.js project write a full...
Read more >
How To Use Node.js Modules with npm and package.json
Let's run through this example. In your locator application, you will use the axios library, which will help you make HTTP requests. Install...
Read more >
Request - npm
Simplified HTTP request client.. Latest version: 2.88.2, last published: 3 years ago. Start using request in your project by running `npm i ...
Read more >
5 ways to make HTTP requests in Node.js - LogRocket Blog
Make HTTP requests in Node.js using the native module as well as npm packages like Axios, Got, SuperAgent, and node-fetch.
Read more >
Node.js Security Best Practices
Denial of Service of HTTP server (CWE-400) · Use a reverse proxy to receive and forward requests to the Node.js application. · Correctly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found