concept input in category node

appears as: input, Input, inputs, inputs
Getting MEAN with Mongo, Express, Angular, and Node.js 2ED

This is an excerpt from Manning's book Getting MEAN with Mongo, Express, Angular, and Node.js 2ED.

From the first lines of the input and output, you should be able to see that

Listing 9.11. Telling page-header.component.ts to accept content as an Input
import { Component, OnInit, Input } from '@angular/core';    #1

@Component({
  selector: 'app-page-header',
  templateUrl: './page-header.component.html',
  styleUrls: ['./page-header.component.css']
})
export class PageHeaderComponent implements OnInit {

  @Input() content: any;                                     #2

  constructor() { }

  ngOnInit() {
  }

}

In a similar way, you can tighten the addReviewByLocationId method in your data service by specifying that the inputs and outputs should be of type Review, changing them from any. The three changes are shown in the following listing.

Node.js in Action, Second Edition

This is an excerpt from Manning's book Node.js in Action, Second Edition.

The first thing you need to do is figure out how to grab -f my.json from the command line; these are the program’s arguments. You also need to read input from stdin. Read on to learn how to do both of these things.

Redirecting input

You’ve already seen how to redirect output, but you can also redirect input in a similar fashion. This is a rare need, but can be a valuable asset if an executable doesn’t accept a filename as an argument. If you want a command to read a file into stdin, use <filename to do so:

hapi.js in Action

This is an excerpt from Manning's book hapi.js in Action.

JSON APIs are the classic use case for hapi. hapi’s extensive feature set—including routing, input and output validation, authentication, caching, and automatic documentation—makes building APIs with hapi a pleasurable experience. You can build APIs that serve all kinds of clients, such as mobile applications, single-page apps, or even other services.

But what exactly do we need to validate? In the vending machine example, I mentioned that we needed to validate the inputs into our systems. In the case of a hapi application, the inputs are the bits of data that we may get sent in HTTP requests—path parameters, query parameters, headers, and payloads.

Figure 6.6 shows an example HTTP request with the input types you can validate with hapi identified. The validate option is used to specify validation criteria for the route’s inputs.

Figure 6.6. The input types you can validate in hapi

The value defined for validate should be an object, consisting of several optional keys. You can specify validation rules for the inputs shown in table 6.3.