Thursday, June 21, 2018

Getting Started With Google Cloud Functions and MongoDB

This article was originally published on Code Barbarian. Thank you for supporting the partners who make SitePoint possible.

Serverless architectures are becoming increasingly popular, and with good reason. In my experience, container-based orchestration frameworks have a steep learning curve and are overkill for most consumer-facing companies. With FaaS architectures, like AWS Lambda and Azure Functions, in theory the only devops you need is bundling and uploading your app.

This article will walk you through setting up a Google Cloud Function in Node.js that connects to MongoDB. However, one major limitation of stateless functions is the need to establish a separate database connection every time the stateless function runs, which incurs a major performance penalty. Unfortunately, I haven't been able to figure out how to reuse a database connection in Google Cloud Functions, the trick that works for IBM Cloud, Azure Functions, and AWS Lambda does not work for Google Cloud Functions.

"Hello, World" in Google Cloud Functions

Go to the Google Cloud Functions landing page and click "Try it free".

Click on the hamburger icon in the upper left and find the "Cloud Functions" link in the sidebar, then click "Create function".

Name your function "hello-world" and leave the rest of the options in the "Create function" form unchanged. Leave "Function to execute" as "helloWorld", because that needs to match the name of the function your code exports. Below is the code you should enter in, so you can confirm what version of Node.js your function is running on.

exports.helloWorld = (req, res) => {
  res.send('Hello from Node.js ' + process.version);
};

Click "Create" and wait for Google to deploy your cloud function. Once your function is deployed, click on it to display the function's details.

Click the "Trigger" tab to find your cloud function's URL.

Copy the URL and use curl to run your cloud function.

$ curl https://us-central1-test21-201718.cloudfunctions.net/hello-world
Hello from Node.js v6.11.5
$

Google Cloud Functions don't give you any control over what version of Node.js you run, they run Node.js v6.11.5 currently. You can't use async/await natively on Google Cloud Functions at the time of this writing.

Connecting to MongoDB Atlas

Click on the "Source" tab in the function details and hit the "Edit" button. You'll notice there's 2 files in your source code, one of which is package.json. Edit package.json to match the below code.

{
  "name": "sample-http",
  "version": "0.0.1",
  "dependencies": {
    "co": "4.6.0",
    "mongodb": "3.x"
  }
}

Once you redeploy, Google Cloud will automatically install your npm dependencies for you. Now, change your index.js to match the below code, replacing the uri with your MongoDB Atlas URI.

The post Getting Started With Google Cloud Functions and MongoDB appeared first on SitePoint.


by Valeri Karpov via SitePoint

15 Tools and Resources That Will Help You Grow as a Designer

This article was created in partnership with BAWMedia. Thank you for supporting the partners who make SitePoint possible.

It's hard to stay in your web design comfort zone when trends and technologies are in a continual state of change. Many of your design and development tools might continue to serve you well for some time. The same may be true for the resources you rely on.

There will come a time however when a favored tool or a resource is no longer up to the task. Investing in new tools or resources is generally the easiest way to keep up with the changing times. This is especially when a tool or resource is easily affordable, and in some cases, free.

This might be a good time to take stock of what you have in your designer's toolkit. See whether some changes might be in order. This list of 15 of 2018's top tools and resources should get you off to a good start.

1. Mason

Mason

Requirements are always subject to change. These changes can be a headache to designers and developers as they usually involve repetitive cycles of work. Many of today's software tools are equipped to handle requirements changes only to the extent that they can repeat prior tasks.

Mason has a different approach.

Mason is a combination design/development, and maintenance/collaboration tool that can put an end to repetitive deployment cycles by relieving designers or developers the task of instituting changes or fixes they shouldn't have to be bothered with.

Mason has a wealth of software design features, including pre-packaged building blocks that address common requirements. What Mason does that is different is to allow downstream users (software maintenance individuals or teams, and even clients) to make changes in these building blocks in response to changing requirements or needs for fixes or product updates.

Mason's login and user registration protocols ensure that you always have total control over product changes, even though as a team leader or designer you're no longer required to make them yourself.

2. Mobirise

Mobirise

The ability to create mobile-friendly websites and apps is no longer a nice option to work with. In today's world it's mandatory. Some themes still treat device-friendliness as if it were a good design option to have. Mobirise on the other hand, was created with mobile devices in mind.

Not only does Mobirise contain everything you need to build device-friendly websites and apps, but it does so without any cost to you and without any restrictions whatsoever. Mobirise is free to use for both your personal and commercial pursuits. It's simply a matter of downloading it now and getting started.

Mobirise is an offline app, so you'll have total control over product design and hosting. It's also an excellent choice for smaller projects such as small websites, portfolios, landing pages, and promo sites.

3. Elementor

Elementor

If you don't believe Elementor is the #1 WordPress page builder on the market, you might take a close look at the numbers. 900,000 or so users downloaded this free, open source and feature rich page-building platform in a little less than 2 years.

Performance and ease of use account, in part, for Elementor's popularity, but its users also love its superior workflow features, visual form builder, custom CSS, and the menu builder.

Things are only going to get better for this product's users — and for you as well if you choose to download it. The Elementor 2.0 release, with a wealth of powerful new tools is already underway and will continue in increments throughout the rest of the year.

New features include enhanced WooCommerce shop product pages, single post page builders, new eCommerce page-building options and more. Users still can enjoy their favorite features of 1.0 version, too.

4. Goodiewebsite

Goodiewebsite

Goodiewebsite has helped hundreds of clients with website development. This is a platform, which specializes in websites on the order of 1-10 pages in size, design to code conversion (PSD, Sketch, Figma, XD, etc.), and simple WordPress sites.

Goodiewebsite services are cost effective and the tasks assigned to them are always performed professionally and reliably.

5. monday.com

monday.com

Whether you're a team of two, or a team of 20,000 scattered around the globe, and whether it is tech on non-tech oriented, if you're looking for a high-performance team management tool, monday.com will suit your needs to perfection.

This team management tool allows you to accomplish tasks without spreadsheets or white boards and avoids any need for scheduling an unending series of meetings. monday.com promotes project transparency and empowers team members.

6. A2's Fully Managed WordPress Hosting

A2

A2 Hosting adjusts to your specific hosting requirements instead of the other way around. You can expect to receive precisely the hosting experience you want and need at an affordable price other services simply cannot match. Site staging, automated backups, blazing fast servers, 24/7 Guru support – it's all there!

7. The Hanger

The Hanger

Whether the plan is to create an online presence for an existing clothing retailer or open a strictly eCommerce business, you might as well do it with a touch of pizzaz to draw the customers in.

The Hanger is a modern-classic WordPress theme that's just the cup of tea for building a high-quality online store in no time at all and customizing it to fit your brand or your client's.

The post 15 Tools and Resources That Will Help You Grow as a Designer appeared first on SitePoint.


by SitePoint Team via SitePoint

Instagram reaches 1 billion monthly users

After surpassing 800 million monthly active users last September, we knew it was only a matter of time before Instagram would reach that coveted 1 billion mark -- and today is that day. The company has announced its latest milestone at an event in San Francisco, where it's also launching IGTV, its...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

JavaScript Regex Cheat Sheet

9 No-Fail Tips For Giving Constructive Criticism At Work - Infographic

Though criticism is an inevitable part of any workplace, most people find it difficult to give negative feedback to direct reports. Whether you are offering real-time observations or engaging in a formal review discussion, it can be stressful to critique the work of your colleagues. Don’t let...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

The Future of Ecommerce: 17 Stats Online Shop Owners Should Know [Infographic]

So, you run an Ecommerce website, you’re doing what you can to increase sales, but are you staying up to date with future trends and understanding how they could affect your business? Go People share the trends and stats you need to know in this infographic. They break things down into the...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

Skills for the Future - #infographic

We live in a world of accelerating change, where new industries are constantly being born and old ones are becoming obsolete. We’re on the cusp of the Fourth Industrial Revolution (or Industry 4.0). InfoGraphicDesignTeam has identified five survival skills of the future, that the young generation...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World