Tag: javascript

Protect GraphQL Properties With JWT In A Node.js Application

July 2, 2018 Nic Raboy

So you started playing around with GraphQL and Node.js. Did you happen to get up to speed with my previous tutorial titled, Getting Started with GraphQL Development Using Node.js? Regardless on how you've jumped into GraphQL, you're probably at a time where you need to figure out how to protect certain queries or pieces of data from the general public through some kind of permissions or roles.

When building a RESTful API, the common approach to endpoint protection is with JSON web tokens (JWT). In fact, I even wrote a previous tutorial on the subject, but how does that have relevance to GraphQL?

We're going to take the common JWT approach and apply it towards protecting queries as well as particular pieces of data in a GraphQL API created with Node.js.

Read More

Getting Started With GraphQL Development Using Node.js

May 22, 2018 Nic Raboy

I've been playing around with GraphQL for a little over a month now, just to see if it is worth all the buzz it has been getting when it comes to modern API development. I must say that the more I use it, the more I'm coming to like it.

I recently wrote a few tutorials around getting started with GraphQL using Golang, but being the polyglot that I am, I wanted to see how difficult it would be to accomplish the same in something else, like Node.js. After having made an attempt, I found that it really isn't any different as it is the same concept, just a different language.

We're going to see how to get started with developing a web application with Node.js that can be queried with GraphQL rather than the traditional RESTful API endpoint approach.

Read More

Scraping Paginated Lists With Node.js, Cheerio, Async / Await, And Recursion

May 15, 2018 Siegfried Grimbeek

In this tutorial we are going to develop a small Node.js application which will be used to scrape paginated content and export the data to a JSON file. The full source code for the tutorial can be found here.

We will be scraping a list website and saving ten lists per page from the "new lists" section and the final application can be seen below.

Read More

A Vue.js App Using Axios With Vuex

April 24, 2018 Siegfried Grimbeek

In this tutorial we will build a simple Vue.js application which will demonstrate the power of using Vuex as a central data store, where the data will be asynchronously retrieved using Axios for the API requests.

A basic level of HTML, CSS and JavaScript will be beneficial but is not required.

Read More

Simple User Login in a Vue.js Web Application

April 16, 2018 Nic Raboy

Sometimes the best examples towards learning a new framework is through a simple user login sample. Login involves many concepts, including forms, data binding, routing, and potentially HTTP to a remote service, all of which are core concepts in any web application.

We're going to see how to implement a simple login form in a web application that uses the Vue.js JavaScript framework.

Read More

Access And Change Parent Variables From A Child Component With Vue.js

April 9, 2018 Nic Raboy

When working with single page web applications (SPA), chances are you're going to be using a router or some kind of parent and child component structure. In these scenarios, the parent components probably hold their own functions and variables that may at some point in time need to be accessed by the child component. Take for example an application that has authentication. The parent component might manage the authentication state while the child component might be a login form, secure content, or something else. When logging in, you might need to change the authentication state of the parent. This is just one of many possible examples where the child and parent need to interact.

We're going to see how to interact with a parent component from a child component in an application created with the Vue.js JavaScript framework.

Read More

Use Node.js And A Raspberry Pi Zero W To Scan For BLE iBeacon Devices

March 14, 2018 Nic Raboy

Earlier this month I had written a tutorial for detecting nearby BLE iBeacon devices using a Raspberry Pi Zero W and an application written with Golang. It was a great example of accomplishing something with Go and very little code.

Scanning for BLE devices is a great use case for Internet of Things (IoT) devices like the Raspberry Pi Zero W, and Golang isn't the only great language around. I, like many others, do a lot of Node.js development as well.

We're going to see how to scan for BLE iBeacon devices using Node.js and the popular Node.js BLE (Noble) library.

Read More