druv5319 / Sneaks-API

A StockX, FlightClub, Goat, and Stadium Goods API all in one. This sneaker API allows users to search sneakers and track and compare prices while providing additional info such as product links and images
448 stars 118 forks source link

UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server #3

Closed invictus2010 closed 4 years ago

invictus2010 commented 4 years ago

Hey there,

I have a very simple script that mocks up your Method 1 in the getting started guide.

const SneaksAPI = require('sneaks-api');
const Datastore = require('nedb');
const cron = require('node-cron');

const sneaks = new SneaksAPI();
sneaks.getProducts("Yeezy Cinder", function(err, products){
    console.log(products)
});

In my terminal I then run node priceHistory.js and get the following error:

Sneaks app listening on port 3000 (node:11419) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) { name: 'MongoNetworkError' }]

Any idea what's up?

druv5319 commented 4 years ago

Sorry, I forgot to mention you'll need to download and start MongoDB for the API to work https://docs.mongodb.com/manual/installation/ I'll try pushing out an update soon so that the API doesn't use MongoDB. Let me know if that works.