const port = 20115
    , express = require("express")
    , expressLogging = require('express-logging')
    , logger = require('logops')
    , PinterestAPI = require('pinterest-node-api');
const pinterest = new PinterestAPI();
pinterest.setUserToken('AvEK_VvwiHZMPUHkt_3kfqp4pbILFdIAfhHDD0dGRD1sMOCmBAqvQDAAAmV1RkRCAEOgzHIAAAAA');

var app = express();
app.use(expressLogging(logger));
app.listen(port, () => {
    logger.info({ port: port }, "Server started...");
});

app.get('/me', (req, res, next) => {

    var data = {
        fields: 'id,note',
        limit : 1
    };
    try {
        var response = pinterest.users.getUserPins(data);
    } catch (error) {
        return;
    }

    res.json({ code: 200, data: response })
})
