Anatomy of Sails.js API With GraphQL

If you’re having troubles with organizing your API for a Node.js app, using the Sails.js framework with GraphQL, know that you’re not the only one – we’ve been there too.
Since this is not an every-day combination of technologies, it was challenging to define the anatomy of such an app and its tests, but we did it!

Link: https://dzone.com/articles/anatomy-of-sailsjs-api-with-graphql?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Zero to Express on OpenShift in Three Commands

With the recent announcement that Node.js is generally available as part of Red Hat OpenShift Application Runtimes, I wanted to see how easy it was to deploy an Express.js app on OpenShift.
Getting Started
Before we start, there are some required prerequisites. You need to have Node 8.x and npm 5.2 or greater installed. npm comes with the official node distribution, so if you install Node from Nodejs.org, you should be good.

Link: https://dzone.com/articles/zero-to-express-on-openshift-in-three-commands?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Build Secure User Management With Vue.js, Node, and Okta

Many of us have danced the JavaScript framework shuffle for years starting with jQuery, then on to Angular. But Angular is complex, so we turn to React. With React, what seems simple on the surface can end up being a frustrating mess. Enter Vue.js. It works as expected. It’s fast. The documentation is incredible. Templating is eloquent.
There’s a unanimous consensus around how to handle state management, conditional rendering, two-way binding, routing, and more. I’ve seen so many developer’s walk this same path, so today I want to take you through how to build a basic app with Vue.js and Node. This tutorial will take you step by step through scaffolding a Vue.js project, offloading secure authentication to Okta’s OpenID Connect API (OIDC), locking down protected routes, and performing CRUD operations through a backend REST API server. This tutorial uses the following technologies but doesn’t require intimate knowledge to follow along:

Link: https://dzone.com/articles/build-secure-user-management-with-vuejs-node-and-okta?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

5 Facts to Know About Node.js Development

Node.js is an open source and cross-platform system for building web applications. Basically, a server capable of executing JavaScript. It provides asynchronous and event-driven APIs. Further, it is quite easy to learn Node.js if you’re already familiar with JavaScript. However, there are also some myths about this platform, such as Node.js relies on Chrome V8 engine, it supports multi-threading, beginner developers can’t work with Node; and the list goes on. 

Link: https://dzone.com/articles/5-facts-to-know-about-nodejs-development?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Node.js General Availability in Red Hat OpenShift Application Runtimes

Summary
Red Hat is making Node.js generally available to Red Hat customers through a subscription to Red Hat OpenShift Application Runtimes (RHOAR). RHOAR provides application developers with a variety of application runtimes running on the OpenShift Container Platform.
Node.js is based on the V8 JavaScript engine and allows you to write server-side JavaScript applications. Node.js joins the existing set of supported runtimes and offers developers an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Link: https://dzone.com/articles/nodejs-general-availability-in-red-hat-openshift-a

Two Methods for Building Your First MERN Stack App

The trend I’ve seen in web applications is a backend API written in a server-side technology like Node, with a front-end single-page application written in something like React. The problem with these stacks is that it can be hard to run and deploy them as a single unit. The API and UI will need to be started, stopped and deployed separately. That can be a bit of a pain when developing, and if you are writing the API to only be consumed by that single front end, the extra steps can be unnecessary. If this sounds like you, I’ll show you the two main paths I found for setting up a MERN (Mongo, Express, React, and Node) stack application to run and deploy as a single code base.
1. Roll Your Own
I found a great couple of articles on setting up React and Node to run together by Dave Ceddia who writes a lot about React. The first tutorial is fine for setting up the development environment, but it doesn’t talk much about how to get things ready to deploy. I deploy most of my personal stuff on Heroku, so the second article was just what the doctor ordered for me. The tl;dr is to start with create-react-app to generate the base React application, then add the Express application around it. The biggest trick is in the scripts section of the server’s package.json file. Here’s what I did by following David’s tutorial and then adding a little magic of my own.

Link: https://dzone.com/articles/two-methods-for-building-your-first-mern-stack-app?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

How to Build a URL Shortener With Node.js and MongoDB

In this post, we’ll show you how to build a URL shortening service like bit.ly or goo.gl using Express.js (Node.js) and MongoDB. Here’s a demo of the final product we’ll be building through our MongoDB hosting platform.
How Does a URL Shortener Work?
At a very high level, the URL shortener works by taking an entered URL and creating a relatively shortened version simplified into an easy to share format. The shortened hash will be generated by base-encoding an auto-incremented counter and creates a minimum three-character hash that increases as the number of stored URLs go up.

Link: https://dzone.com/articles/how-to-build-a-url-shortener-with-nodejs-and-mongo?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Serverless development with Node.js, AWS Lambda and MongoDB Atlas

This article was originally published on mongoDB. Thank you for supporting the partners who make SitePoint possible.
The developer landscape has dramatically changed in recent years. It used to be fairly common for us developers to run all of our tools (databases, web servers, development IDEs…) on our own machines, but cloud services such as GitHub, MongoDB Atlas and AWS Lambda are drastically changing the game. They make it increasingly easier for developers to write and run code anywhere and on any device with no (or very few) dependencies.
A few years ago, if you crashed your machine, lost it or simply ran out of power, it would have probably taken you a few days before you got a new machine back up and running with everything you need properly set up and configured the way it previously was.
With developer tools in the cloud, you can now switch from one laptop to another with minimal disruption. However, it doesn’t mean everything is rosy. Writing and debugging code in the cloud is still challenging; as developers, we know that having a local development environment, although more lightweight, is still very valuable.
And that’s exactly what I’ll try to show you in this blog post: how to easily integrate an AWS Lambda Node.js function with a MongoDB database hosted in MongoDB Atlas, the DBaaS (database as a service) for MongoDB. More specifically, we’ll write a simple Lambda function that creates a single document in a collection stored in a MongoDB Atlas database. I’ll guide you through this tutorial step-by-step, and you should be done with it in less than an hour.
Let’s start with the necessary requirements to get you up and running:

An Amazon Web Services account available with a user having administrative access to the IAM and Lambda services. If you don’t have one yet, sign up for a free AWS account.
A local machine with Node.js (I told you we wouldn’t get rid of local dev environments so easily…). We will use Mac OS X in the tutorial below but it should be relatively easy to perform the same tasks on Windows or Linux.
A MongoDB Atlas cluster alive and kicking. If you don’t have one yet, sign up for a free MongoDB Atlas account and create a cluster in just a few clicks. You can even try our M0, free cluster tier, perfect for small-scale development projects!).

Now that you know about the requirements, let’s talk about the specific steps we’ll take to write, test and deploy our Lambda function:

MongoDB Atlas is by default secure, but as application developers, there are steps we should take to ensure that our app complies with least privilege access best practices. Namely, we’ll fine-tune permissions by creating a MongoDB Atlas database user with only read/write access to our app database.
We will set up a Node.js project on our local machine, and we’ll make sure we test our lambda code locally end-to-end before deploying it to Amazon Web Services.
We will then create our AWS Lambda function and upload our Node.js project to initialize it.
Last but not least, we will make some modifications to our Lambda function to encrypt some sensitive data (such as the MongoDB Atlas connection string) and decrypt it from the function code.

A Short Note About VPC Peering
Continue reading %Serverless development with Node.js, AWS Lambda and MongoDB Atlas%

Link: https://www.sitepoint.com/serverless-development-with-node-js-aws-lambda-and-mongodb-atlas/

How to Create a Twitter Bot with Node.js

Twitter bots have been in the news over the past few years due to election meddling, not only in the United States but stretching across the globe.  There are, however, good and logical reasons for creating Twitter bots.  In order to see how easy it was to create a Twitter bot, for good or evil, […]
The post How to Create a Twitter Bot with Node.js appeared first on David Walsh Blog.

Link: https://davidwalsh.name/create-twitter-bot

Build User Registration With Node, React, and Okta

Today’s internet users expect a personalized experience. Developers must learn to develop websites that provide that personalized experience while keeping their user’s information private. Modern web applications also tend to have a server-side API and a client-side user interface. it can be challenging to get make both ends aware of the currently logged in user. In this tutorial, I will walk you through setting up a Node API that feeds a React UI, and build a user registration that keeps the user’s information private and personal.
In this tutorial, I won’t use any state management libraries like Redux or ReduxThunk. In a more robust application, you’ll probably want to do that, but it will be easy to wire up Redux and ReduxThunk and then add the fetch statements used here as your thunks. For the sake of simplicity, and to keep this article focused on adding user management, I’ll be adding fetch statements into componentDidMount functions.

Link: https://dzone.com/articles/build-user-registration-with-node-react-and-okta?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev