Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Steps for getting started needed #2

Open
penny506 opened this issue Nov 30, 2024 · 1 comment
Open

Basic Steps for getting started needed #2

penny506 opened this issue Nov 30, 2024 · 1 comment

Comments

@penny506
Copy link

I have a little bit of node experience, but between getting the 'node install' to trying to get this 'require' syntax to find the index.js, I'm running into many issues that a more seasoned person may know, but I'm having troubles, and I think a 4 line extra in readme would go a long way - thanks!!

@penny506
Copy link
Author

penny506 commented Nov 30, 2024

One problem was axios version - I ran:
npm audit fix --force
Which fixed that

Also More sample code which may help:
(used environment vars for keys as:
npm install dotenv
and created .env at root)


const Untappd = require("./index");
require('dotenv').config();
const client = new Untappd();

client.setClientId(process.env.UNTAPPD_CLIENT_ID)
client.setClientSecret(process.env.UNTAPPD_CLIENT_SECRET);
 
console.log(client)

const data = {USERNAME:"1234"};

client.userActivityFeed(data)
    .then(data => {
        // Access the check-ins
        const checkins = data.response.checkins.items;

        checkins.forEach(checkin => {
            console.log(`Beer: ${checkin.beer.beer_name} by ${checkin.brewery.brewery_name}`);
            console.log(`${checkin.venue.venue_name} On: ${checkin.created_at}`);
        if( checkin.media.items[0])
                console.log(`With Image:`+checkin.media.items[0].photo.photo_img_sm )
        });
    })
    .catch(err => console.log(err));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant