Thursday, December 7, 2017

9 Must-Have Travel Tech Accessories [Video]

Ralph Waldo Emerson once said, "Life is a journey, not a destination." Yeah, well he never had to take a 10-hour flight in coach. Vacations are fun (hopefully), but getting to the destination and losing out on some of the creature comforts of home is kind of a drag. Then you have to try...

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

by Irfan Ahmad via Digital Information World

The Decentralized Content Marketing Playbook - #Infographic

In the past, content marketing revolved around one thing: your blog. Marketers lived by the promise that if they wrote quality articles on their website's blog, traffic would come. And after decades of interruptive television commercials and dinnertime cold calling, it was a welcome change in...

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

by Web Desk via Digital Information World

History Of Modern Adversting - #infographic

Advertising is not going away, but it has very different strategies and tactics, traditional "push/pull" marketing no longer works, and so are highly-touted customer relationship initiatives. Smart companies are those that are looking for marketing innovation as a new route to marketing...

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

by Web Desk via Digital Information World

Julian Humm

Minimal personal page for graphic designer Julian Humm featuring an interactive ripple effect background.

Full Review | Direct Link


by Rob Hope @robhope via One Page Love

8 Facebook Ads Mistakes You Should Never Make - #infographic

Why aren’t my Facebook Ads working? There are  more than 100 reasons why your Ads aren’t converting users into visitors, leads, and sales. But among these 100 reasons, there’re those that are cardinal – mistakes that are not forgivable by any standards. Here’s a quick list of them: Spelling...

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

by Web Desk via Digital Information World

Understanding ExpressJS Routing

Introduction

Express is a popular Node.js web framework. Amongst its functionality, it provides a wrapper for Routing. The Express Router helps in the creation of route handlers. In this tutorial, you will learn how to work with Express Router.

Let's get started.

Create a new directory for your application. Run the command to initialize npm in the directory you just created.

The only dependency you will need is express, so go ahead and install it.

At the end, your package.json file should look like this.

Now create a new file called index.js, which will be your entry file as stated in your package.json.

For now, you just need a basic setup like this:

Basic Routing

Start by creating some basic routes as I have below.

  1. An instance of Express Router is created. The instance is set to a variable called router. This variable will be used whenever you want to create a route.
  2. A new route is defined for the GET method to the root of the application. It is attached to the instance of the Express Router class.
  3. A new route is defined for the POST method to the contact page of the application. It is attached to the instance of the Express Router class.
  4. This mounts some middleware that will be used to handle your routes. Here you tell your app that you want to make use of the router (which is the instance of the Express Router) for every request made to the app that corresponds to the path '/'. If you fail to mount a path on this middleware, it will be executed for every request made to the app.

Let's say you had the code below instead.

This will match all the following: /user/profile, user/profile/edit, user/dashboard/article/view, and so on.

Route Methods

In the above code, you attached a route method to an instance of Express Router. The route method is derived from one of the HTTP methods and attached to the instance of the Express Router as you did.

Express supports the following routing methods that correspond to HTTP methods: get, post, put, head, delete, options, trace, copy, lock, mkcol, move, purge, unlock, report, mkactivity, checkout, merge, m-search, notify, subscribe, unsubscribe, patch, and search.

There is a routing method app.all() which is not derived from any HTTP method. This routing method gets loaded for functions at a specified path for all request methods.

Say you have the code below in your application.

This will be executed for requests to "/books" when you are using GET, POST, PUT, or any HTTP request method.

Route Paths

A route path is used to define an endpoint where requests can be made. It does so with the combination of a request method. In Express, route paths can be string patterns or regular expressions.

Here are examples you can add to your index.js file.

Let's see a route path using string patterns.

  1. The route will match abxy, abbxy, abbbxy, and so on.
  2. The route will match /abz and /abxyz.

Route Parameters

These are used to capture values that are specified at a certain position in the URL. They are called URL segments. The values captured are made available in the req.params object, using the name of the route parameter specified in the path as the keys of the values.

Here is an example.

If you have a route path similar to this in your application: /users/:userId/articles/:articleId

The requested URL will look like this: http://localhost:3000/users/19/articles/104

In the req.params, the following will be available: { "userId": "19", "bookId": "104" }

Go ahead and create a new route in your application, using the route path above.

Start your server and point your browser to http://localhost:3000/users/19/articles/104. You will see the req.params object displayed in your browser.

The name of the route parameters must be made up of word characters ([A-Za-z0-9_]).

Let's take it further!

Say you want to have a route path called /users/:name, where the name of the user is passed into the URL and the application displays the name along with a string. How do you think that can be achieved?

Go ahead and try it out on your own first.

Here is what the route should look like.

When you visit http://localhost:3000/users/vivian, you should see Welcome, vivian! displayed in the browser.

Login Routes

Let's see how to create a login route in Express. Your login routes require two actions on a single route path. The actions will be differentiated by the route method used. Here is how it will look.

After doing this, your store form should have an action whose value is the route defined with the HTTP POST method. Here is how it should look.

When the submit button of the form gets clicked, the specified router gets called. The difference between both route paths as stated above is the HTTP POST. This is how the application determines which is responsible for handling the data passed through the form.

Another aspect where this can be experienced is in the area of editing and updating resources.

app.route()

app.route() can be used to create a chain of route handlers for a specific route path.

Using the example of the login route, here is how you will make use of app.route().

You can add more route handlers than we have above.

Conclusion

At this point, you should know how routing works in Express. You have learned how to set up basic routing, and also how to work with route methods and paths. You saw how to make use of route parameters and retrieve values sent via the URL.

If you’re looking for additional JavaScript resources to study or to use in your work, check out what we have available on Envato Market.

With this knowledge, you can go further to build an Express application with complex routing.


by Chinedu Izuchukwu via Envato Tuts+ Code

Influencer Marketing: New Research for Video Creators

Are you a video creator looking to get into influencer marketing? Wondering whether creating sponsored video content is a viable moneymaking option? In this article, you’ll discover insights from new research that reveal how influencer marketing has grown in the last year and how other video creators are planning to pursue relationships with brands. #1: [...]

This post Influencer Marketing: New Research for Video Creators first appeared on .
- Your Guide to the Social Media Jungle


by Michelle Krasniak via