Simple authentication and query example in javascript?

Where can I find a simple authentication and query example for javascript? I can’t seem to find an example anywhere.

Something as simple as returning all of your boards…

1 Like

Does this help?

I made a basic Node.js repo:

1 Like

Yes, thank you Ash for the response!

This is what I ended up with:

import { GraphQLClient } from 'graphql-request';

let getBoards = () => {
    const client = new GraphQLClient(profile.monday_url, {
      headers: {
        Authorization: profile.monday_access_token,
      },
    })

    const query = `{
        boards() {
            id
            name
            owner {
                id
                name
            }
        }
    }`

    client.request(query)
      .then(data => {
        setBoards(data.boards.map(board => {
            return {
                id: board.id,
                name: board.name
            }
        }));
      })
  }
}
1 Like

We now have an API tutorial for Javascript. Check it out here: API Javascript Quickstart