Introducción a las pruebas de desarrollo de Meteor.js & respuestas – Coursera
Bienvenido a un viaje revelador hacia Desarrollo de meteor.js! Sumérgete en el mundo de las aplicaciones web en tiempo real con herramientas cuidadosamente diseñadas. cuestionarios y detallado respuestas.
Si eres un principiante que busca comprender los conceptos básicos o un desarrollador experimentado que busca mejorar sus habilidades, esta colección seleccionada de preguntas y soluciones lo guiará a través de los conceptos clave, mejores prácticas, y aplicaciones prácticas de meteorito.js. Explora cada cuestionario para poner a prueba tus conocimientos, fortalece tu comprensión, y desbloquear nuevos conocimientos sobre Desarrollo de meteor.js.
Examen 1: Prueba de requisitos previos
Q1. Este curso es el tercero de nuestra especialización.. Asumimos que ya conoces algo de Javascript., HTML y CSS. Si eres nuevo en todos estos idiomas, Te recomendamos volver atrás y consultar los cursos anteriores.. De otra manera, Aquí tienes algunas preguntas para poner a prueba tus conocimientos.!
- Ok got it!
Q2. We just want to let you know that the latest version of meteor creates a slightly different starter app than the version we use in this course. It is more complicated than the one shown in the course. We prefer the simpler starter application for teaching, so we provide you with a stripped down starter app and recommend that you start with that.
- Okay!
Examen 2: From one to many users
Q1. Which technology makes it easier to deal with many users?
- Web servers
- HTML
Q2. Where does the web browser software run?
- On the server
- On the client
Examen 3: Install Meteor
Q1. What is the command to run a Meteor application called myApplication?
- meteor add myApplication
- meteorito
Q2. Where does localhost point to on a network?
- The nearest server outside of your network
- Your local machine
Examen 4: Editing a template
Q1. What is spacebars in Meteor?
- A button you press all the time to make your code lay out as neatly as possible.
- A templating language
Q2. Which code defines a template called ‘photoDisplay’?
{{> photoDisplay}}
<template name="photoDisplay"> </template>
Examen 5: Sending data to templates with helpers
Q1. What does Meteor.isClient mean?
- It tests if there is a client connected to the Meteor server
- It tests if this code is running on the web browser or not
Q2. Which of the following are true? Seleccione todas las que correspondan.
- Template helpers can send data to templates which the template can then display.
- Template helpers can send functions to templates that the template can call.
Examen 6: Convert to a Bootstrap grid
Q1. How do you search for packages in Meteor? (select all that are correct)
- Meteor search
- On the atmospherejs.com website
Q2. Why did the image gallery in the video pop down to a single column with 3 filas cuando la ventana del navegador era estrecha?
- Debido a la clase col-md-3 en la etiqueta div
- Debido a la clase col-xs-12 en la etiqueta div.
Examen 7: Responder a las acciones del usuario
Q1. ¿Cómo accedemos a la etiqueta que se relaciona con el evento en una función de evento de plantilla??
- Al acceder
$(event.target).css
- Al acceder
$(event.target)
Q2. Lo que parece el comienzo correcto para agregar detectores de eventos a una plantilla llamada aTemplate?
Template.aTemplate.events
Template.aTemplate.onclick
Examen 8: Introducción al cuestionario resumido de Meteor
Q1. ¿Cuáles son los lenguajes web?? (seleccione todos los que apliquen)
- JavaScript
- HTML
- Web servers
- navegadores web
Q2. Ejecute el siguiente comando para crear una nueva aplicación de meteoritos:
1
meteorito crear mi aplicación
Busque en la carpeta que se ha creado.. ¿Qué archivos o carpetas puedes ver??
- package.json
- Forense digital
- miaplicación.js
- cliente
Tercer trimestre. ¿Cuál es el puerto predeterminado para que se ejecute un servidor Meteor local??
- servidor local
- 3000
- 127.0.0.1
- puerto local
Cuarto trimestre. Seleccione el fragmento correcto de código de plantilla para representar una plantilla llamada "myTemplate"
{{> myTemplate}}
<template name="myTemplate">
{{myTemplate}}
</template>
{{:: myTemplate}}
<template name="myTemplate">
<h2>My template</h2>
</template>
Q5. What is the purpose of the public folder in a web application?
- To store files that have public domain licences.
- To store static files that the client needs to see.
- To store source code files that the client needs to run.
- To store asset files for the server.
Q6. Run the image_share application supplied with this module. Where does the message ‘where am I running’ get printed out? Seleccione todas las que correspondan
- Nowhere
- In the browser web page display window
- In the server console
- In the web browser console
Q7. Which code defines a template helper function that can pass an array called test into a template called testTemp?
Template.testTemp.helpers({
test:function(){
var test = []; return test; } })
<template name="testTemp">
{{test}}
</template>
<template name="testTemp">
{{#each test}} {{img_name}} {{/each}}
</template>
Template.test.helpers({
test:function(){
var testTemp = [];
return testTemp; }
})
Q8. What do you need to add to the following code to make it into a responsive grid?
- An outer div with the class container
- A div inside the row with the class container
- A col-xs-something class.
- Another row to specify what should go in the second row once the screen size is changed
Q9. Why not use onclick attributes to add interactivity in our meteor apps?
- Onclick does not work in Meteor apps
- Templates cannot cope with mouse clicks
- Onclick does not allow us to easily access the event in our application code
- Onclick is not the right attribute to capture a mouse click
Q10. Which code defines a template event listener for a template named myTemplate that will print ‘hello’ when the user clicks on any button in the template?
- Template.myTemplate.events({
‘click .button’: función () {
console.log(‘hello’); } }); - Template.myTemplate.events({
‘click button’: función () {
console.log(‘hello’); } }); - Template.myTemplate.events({
‘click #button’: función () {
console.log(‘hello’); } }); - Template.myTemplate.events({
‘onclick button’: función () {
console.log(‘hello’); } });
Introduction to Meteor.js Development Week 2 Respuestas del cuestionario
Examen 1: Meteor distributed data model
Q1. How many copies of the data can be in a Meteor application at any one time? (assuming all data is visible to all)
- As many as there are connected clients plus one for the server
- As many as there are connected clients
Q2. What is Meteor’s default database server called?
- MySQL
- Mongo
Examen 2: Create a collection of images
Q1. How can we create a collection in Meteor’s database?
Images = Mongo.createCollection("myCollection");
Images = new Mongo.Collection("images");
Q2. What is the purpose of the Meteor.startup function? (select ALL that apply)
- To run code on the server side when the application starts up.
- To run code on the client side when the application starts up.
Examen 3: Better start up script, removing items from a collection
Q1. Which features of this code make it readable? Seleccione todas las que correspondan
if (Meteor.isServer) {
Meteor.startup() {
for (var i = 0; i < 23; i++) {
} // end for iterating images
} // end meteor.startup
} // end meteor.iserver
- Indenting
- Comments ending the if and for blocks
Q2. What is the command to remove something from a collection?
- Remove
- Eliminar
Examen 4: Add an image rating function: Updating and sorting
Q1. What was different about how we dealt with event targets in this module, compared with the previous module?
- We accessed event.currentTarget instead of event.target
- We used jQuery to access the event target
Q2. How do we access an id on something from a Mongo collection?
- _id
- Variables y métodos estáticos
Examen 5: Implement image adding with a Bootstrap Modal
Q1. What kind of event do we listen to on forms?
- Hacer clic
- Submit
Q2. Why do I prefix some CSS class names with ‘js-‘?
- To make it clear they are related to the event code, not the actual CSS layout code.
- Meteor requires that event listener selectors are prefixed with ‘js-‘
Examen 6: Databases and collections summary quiz
Q1. Why is a Meteor application like a database cluster?
- Because the database only runs in the client machines
- Because Meteor applications are very scalable
- Because the server runs on a Mongo cluster
- Because each connected client runs a local copy of the database
Q2. Why do we define collections like this:
Images = new Mongo.Collection("images");
en vez de:
var Images = new Mongo.Collection("images");
- Meteor does not use the word var in its javaScript code.
- If you define a var in a Meteor .js file, it becomes local to that file, and you cannot access it in other .js files in your app. (try it!).
- Variables with capital letters for their name are automatically global variables.
- var is not the correct keyword in javaScript to define a variable.
Tercer trimestre. What does running the command
meteor reset
in a meteor application’s folder do?
- It runs the Meteor.startup function to insert starter data
- It starts the app again
- It creates a new application
- It deletes all data from the database
Cuarto trimestre. Select the correct way of specifying HTML, Comentarios CSS y JavaScript
<!-- this is a Javascript comment -->
// this is an HTML comment
/* this is a CSS comment */
<!-- this is a CSS comment -->
// this is a Javascript comment
/* this is an HTML comment */
<!-- this is an HTML comment -->
// this is an Javascript comment
/* this is a CSS comment */
<!-- this is a CSS comment -->
// this is an Javascript comment
/* this is an HTML comment */
Q5. ¿Cuál de las siguientes es la forma correcta de acceder a una colección en Meteor??
Meteor.Images.find({});
Mongo.find("images", {})
Images.find({})
Images.find().count()
Q6. Respecto a esta llamada a función, que son verdad?
Images.update({_id:'123'}, {$set:{rating:4}});
- El campo de calificación se establecerá en 123
- {_id:'123'} es un filtro de Mongo que solo permite aplicar la actualización a imágenes con el _id ‘123’.
- El comando $set es un comando mongo que permite establecer un campo con un nuevo valor.
- El campo de calificación se establecerá en 4
Q7. ¿Cuál de las siguientes declaraciones recuperará las imágenes con la calificación más baja en primer lugar??
Images.find({}).sort({rating:1});
Images.find({}, {sort:{rating:1}})
Images.find({}, {sort:{rating:-1}})
Images.find({_id:'123'}, {sort:{rating:1}})
Q8. ¿Qué sucede si devolvemos falso desde un detector de eventos de plantilla en Meteor??
- El evento es ignorado
- El navegador no puede realizar su acción predeterminada
- Nada
- Nos aseguramos de que no se inserte nada en la base de datos..
Q9. ¿Qué hay de malo en el siguiente código??
Template.images.events({
"click .js-show-image-form":function(){ }
"click .js-hide-image-form":function(){ }
});
- The items in the property set have strings for their names
- There are no events passed into the event listener functions
- There are full stops (periods) before the CSS selectors
- There are no commas between the items in the property set
Q10. Which code shows a Bootstrap modal with an id of ‘myModal’?
$('#myModal').modal('show');
$('.myModal').modal('hide');
$('.myModal').modal('show');
$('#myModal').modal('hide');
Introduction to Meteor.js Development Week 3 Respuestas del cuestionario
Examen 1: User authentication with Meteor.js
Q1. Which packages should you add for basic user authentication in your database and UI? (seleccione todas las que correspondan)
- accounts-ui
- accounts-password
Q2. When a password reset email is sent from a Meteor server running on your own computer, where is the content of the email printed out?
- In the console
- In a special template
Examen 2: Tidying up the design with a navbar
Q1. What does the max-height CSS property do to images?
- Stops the image from being heigher than a certain height.
- Sets the height of an image and prevents it from going higher.
Q2. What is the name of the user login template provided by accounts-ui?
- loginButtons
- userLogin
Examen 3: Accessing user information
Q1. How do we access a logged in user’s email address?
Meteor.user().emails[0].address
Meteor.user().email_address[0]
Q2. Why do templates that access user data render twice sometimes?
- There is a bug in the meteor code.
- Meteor.user changes during the start up of the app in the browser.
Examen 4: Customising the user registration form
Q1. What is the purpose of the Accounts.ui.config function?
- It only allows you to change the design of the registration form.
- It allows you to re-configure the fields in the registration form.
Q2. Bonus information: which is an alternative way to access user information?
Meteor.users()
Meteor.users.find()
Examen 5: Attaching users to images
Q1. Which of these look like valid template helpers? (seleccione todas las que correspondan)
Template.image_list.helpers({
images: [
{img_alt:"my image"},
{img_alt:"my other image"}
] });
Template.image_list.helpers({
images: function(){
return Images.find({});
}
});
Q2. ¿Cuál es la forma correcta de insertar una imagen en una colección de base de datos??
Images.insert(img_alt, img_src, userId)
Images.insert({img_alt: img_alt, img_src: img_src, userId: userId})
Examen 6: Filtrar imágenes por usuario
Q1. ¿Por qué siempre necesitamos un atributo href en una etiqueta a?? Elige la respuesta más precisa.
- sin href, el navegador no aplicará los cambios visuales esperados cuando un usuario mueva el mouse sobre el enlace.
- Los enlaces siempre necesitan ir a alguna parte. El href le dice al navegador a dónde va el enlace..
Q2. ¿Cuántas copias de la variable Session crees que hay en una aplicación Meteor completa??
- Uno.
- Uno para cada cliente conectado.
Examen 7: Quitar el filtro de imagen
Q1. Se le proporciona una función de ayuda de la siguiente manera:
Template.image_list.helpers({
greaterThan5:function(input){
console.log(input);
if (input > 5){
return true;
} else {
return false; } } });
¿Cuál es la sintaxis correcta para un bloque if en una plantilla que utiliza este asistente??
{{#if greaterThan5 10}} 10 is greater than 5 {{/if}}
{{#if greaterThan5(10)}} 10 is greater than 5 {{/if}}
Q2. ¿Cómo se desarma una clave llamada "myKey" en una sesión??
Session.set(‘myKey’, undefined)
Session.unset(‘myKey’)
Examen 8: Scroll infinito
Q1. ¿Por qué deberíamos usar un desplazamiento infinito??
- Es técnicamente impresionante..
- El sitio se cargará más rápido..
Q2. ¿Qué significa límite en una consulta de búsqueda de base de datos??
- Limita la cantidad de conexiones que se realizan a la base de datos a la vez para hacer que el servidor sea más eficiente..
- Limita la cantidad de artículos que se devolverán..
Examen 9: Prueba resumida de autenticación de usuario
Q1. ¿Cuál de los siguientes tipos de cuentas de usuario son compatibles con los paquetes de meteor?? (pista: ejecuta el comando
cuentas de búsqueda de meteoritos )
Seleccione todas las que correspondan
- Gorjeo
- Github
Q2. ¿Qué sucede con el contenido de su página cuando configura una barra de navegación de posición fija??
- La parte superior está oculta detrás de la barra de navegación..
- Se mueve hacia abajo por la altura de la barra de navegación..
- El contenido de la página siempre está completamente oculto..
- La página ya no se puede desplazar..
Tercer trimestre. Fuentes de datos reactivas...
- Son sólo otro nombre para las colecciones de bases de datos.
- Cambiar automáticamente en respuesta a eventos desencadenados por el usuario
- Hacer que las plantillas que dependen de esa fuente de datos se vuelvan a representar automáticamente si los datos cambian
- Puede reaccionar ante diferentes circunstancias que puedan ocurrir en la aplicación..
Cuarto trimestre. ¿Qué es Meteor.user?() función para?
- Accediendo al usuario actual.
- Iniciar sesión como usuario.
- Creando un nuevo usuario en la base de datos.
- Descubrir el nombre de usuario con el que se ejecuta el servidor Meteor.
Q5. ¿Cuál de las siguientes especifica una función auxiliar de plantilla que devuelve el nombre de usuario si el usuario ha iniciado sesión??
- Ayudantes.del.cuerpo.de.plantilla({
nombre de usuario: función(){
var usuario = Meteor.usuario();
Si (usuario){
devolver usuario.nombre de usuario; } } }); - Ayudantes.del.cuerpo.de.plantilla({
nombre de usuario: función(){
var usuario = Usuarios.findOne({_id:Meteorito.ID de usuario()})
Si (usuario){
devolver usuario.nombre de usuario; } } }); - Ayudantes.del.cuerpo.de.plantilla({
nombre de usuario: función(){
var usuario = usuario();
Si (usuario){
devolver usuario.nombre de usuario; } } }); - Ayudantes.del.cuerpo.de.plantilla({
nombre de usuario: función(){
var usuario = Meteor.users.findOne({_id:Meteorito.ID de usuario()})
Si (usuario){
devolver usuario.nombre de usuario; } } });
Q6. Seleccione las opciones donde la variable a es "verdadera"
- var a = -1;
- var a = 10 == 5;
- var a = 1;
- var a = 0;
Q7. ¿Cuáles de las siguientes son fuentes de datos reactivas??
- var miValorDeMódulo = 10;
- La colección de imágenes de este curso.
- Sesión
- Usuario de meteorito()
Q8. Qué está mal con este código?
Template.imageList.helpers({
nombre de usuario: función(){
var usuario = Meteor.users.findOne({_id:Meteorito.ID de usuario()})
Si (usuario){
devolver usuario.nombre de usuario;
}
}
imagenes: función(){
var filter = {userId:Meteorito.ID de usuario()};
return Images.find(filtrar);
- There is no comma between the properties in the property set
- You cannot specify filters as variables, so the find function will not work
- There is no semicolon at the end of the line ‘var user = Meteor.users.findOne({_id:Meteorito.ID de usuario()}) '
- The username helper does not return anything if there is no user available.
Q9. Which is the correct way to specify a template helper function that returns true if the user is logged in, which can be used in a template if block?
- Ayudantes.del.cuerpo.de.plantilla({
isLoggedIn:función(){
Si (Usuario de meteorito().username == ‘anonymouse’){
falso retorno;
} más {
return true; } }, }) - Ayudantes.del.cuerpo.de.plantilla({
isLoggedIn:función(){
return Meteor.user() }, }) - Ayudantes.del.cuerpo.de.plantilla({
isLoggedIn:return Meteor.user(), }) - Ayudantes.del.cuerpo.de.plantilla({
isLoggedIn:función(usuario){
return user.isLoggedIn; }, })
Q10. What is wrong with displaying all the images in the database at once in the template? (seleccione todas las que correspondan)
- Templates are limited to 100 iterations of a loop.
- There will be an unnecessary load placed on the server as it reads the images from disk and sends them out to the client.
- The Session variable prevents this by default.
- The site will take a long time to load.
Introduction to Meteor.js Development Week 4 Respuestas del cuestionario
Examen 1: How to organise your code
Q1. Which files do not go in the public folder?
- Meteor app javaScript code such as template helper functions
- Image files
Q2. Why are Meteor.isClient and Meteor.isServer not needed in code in the server and client folders?
- Code in the client and server folders will only run on the client or the server, respectivamente. Por lo tanto, we do not need to test where it is running.
- It is guaranteed that Meteor will run all of the code in these folders on both the client and the server.
Examen 2: Hack into your site!
Q1. In terms of what you have access to, the browser console environment is equivalent to:
- The inside of an ‘if(Meteor.isServer)’ block
- The inside of an ‘if(Meteor.isClient)’ block
Q2. What was the key message in this video?
- Don’t use databases to store user generated content.
- Don’t trust users to behave on your site.
Examen 3: Make your site more secure
Q1. What is the name of the package that makes your app easier to develop, but not very secure
- Insecure
- Seguro
Q2. En el video, before we implemented delete permissions, why does the image disappear then re-appear when we click on it?
- The jQuery code makes the image disappear, then the animation is cancelled as the image is not allowed to be deleted.
- The image is actually deleted from the local copy of the collection, but when the server checks the permissions, it blocks the delete from happening to the central copy. Entonces, la colección local se resincroniza y la reactividad hace que la plantilla se vuelva a representar.
Examen 4: Ordenar el proyecto
Q1. Cual de los siguientes es verdadero?
- La carpeta lib solo se envía al servidor..
- El código JavaScript en la carpeta lib se ejecuta antes que otro código.
Q2. ¿Necesitas el 'si'?(Meteor.isServer)' prueba en la carpeta lib?
- Sí
- No
Examen 5: Enrutamiento con hierro:enrutador
Q1. Si ponemos el siguiente código en el código javascript de nuestro cliente, qué plantilla se representará cuando visitemos http://servidor local:3000/imagenes?
Router.route('/', function(){
this.render('images');
});
Router.route('/images', function(){
});
- La plantilla de imágenes.
- La plantilla de la barra de navegación.
Q2. ¿Por qué necesitamos utilizar el enrutamiento??
- Para permitir la especificación de diferentes páginas en el sitio a las que el usuario puede moverse, sin necesidad de recargar completamente la página.
- Permitir la creación de un mapa del sitio que muestre las rutas alrededor del sitio..
Examen 6: Mejor enrutamiento
Q1. ¿En qué se debe configurar el atributo de nombre de la plantilla de diseño principal si configuro el enrutador usando el siguiente código?:
Router.configure({
layoutTemplate:'MainLayout',
})
- Diseño principal
- Plantilla de diseño
Q2. ¿Qué significa el rendimiento en el siguiente código??
{{> yield "header"}}
- Le indica al enrutador que hay un punto en la plantilla de diseño en el que puede representar subplantillas y que se llama "encabezado"..
- Le está indicando al enrutador que muestre una plantilla llamada "encabezado" en este punto..
Examen 7: Cuestionario resumido sobre seguridad y enrutamiento
Q1. ¿En qué carpeta colocarías el código auxiliar de la plantilla?? (elige la mejor opción)
- Forense digital
- compartido
- cliente
- público
Q2. ¿Dónde pondrías el código de definición de colección?? (elige la mejor opción)
- compartido o importaciones para versiones más nuevas de meteor
- público
- Forense digital
- cliente
Tercer trimestre. ¿Qué hará el siguiente código si lo ejecuta en la consola del navegador??
para (donde en = 0; yo < 1000; yo += 2){
Imágenes.insertar({
“img_src”:"no es bueno!”});}
- Nada: la consola del navegador tiene funciones de seguridad que impiden que usuarios malintencionados ejecuten códigos peligrosos en sitios web..
- Insertar 500 imágenes en la colección de imágenes
- Insertar 1000 imágenes a la colección de imágenes
- Nada: no puedes insertar imágenes usando un bucle
Cuarto trimestre. ¿Cuál es el código correcto para verificar que el usuario haya iniciado sesión antes de que pueda eliminar una imagen?? (seleccione todas las que correspondan)
- Imágenes.eliminar.permitir(función(userId, doc){
Si (userId){
return true;
} más {
falso retorno; } }) - Imágenes.permitir({
eliminar:función(userId, doc){
Si (userId){
return true;
} más {
falso retorno; } } }); - Imágenes.permitir({
eliminar:función(userId, doc){
Si (Usuario de meteorito()){
return true;
} más {
falso retorno; } } }); - Imágenes.permitir({
Eliminar:función(userId, doc){
Si (userId){
return true;
} más {
falso retorno; } } });
Q5. ¿Qué imprimirá el siguiente código en la consola del navegador cuando un usuario intente insertar una imagen?. suponiendo que hayan iniciado sesión?
Imágenes.permitir({
insertar:función(userId, doc){
Si (Meteor.isServer){
console.log(“insertar en el servidor”);
}
Si (Meteor.isClient){
console.log("insertar en el cliente");
}
Si (Usuario de meteorito()){
return true;
- Insertar en el cliente
- Insertar en el cliente Insertar en el servidor
- Insertar en el servidor
- Nada
Q6. ¿Dónde debería colocar el código de inicio del servidor??
- En la carpeta del servidor
- En la carpeta lib
- En la carpeta del cliente
- En la carpeta de inicio
Q7. ¿Cuál de las siguientes especificaciones de ruta mostrará la plantilla de imágenes cuando el usuario visite http?://servidor local:3000/imagenes ?
- enrutador.ruta('/', función(){ esto.renderizar('imágenes'); });
- enrutador.ruta('imágenes', función(){ esto.renderizar('/'); });
- enrutador.ruta('/imágenes', función(){ esto.renderizar('imágenes'); });
- enrutador.ruta({ imagenes: función(){ esto.renderizar('imágenes'); } });
Q8. ¿Cuál de las siguientes es la forma más correcta de crear una ruta que pueda llevar al usuario a una vista llamada "/imágenes"??
<a href="images">go to images</a>
<a href="http://localhost:3000/images">go to images</a>
<a href="/images">go to images</a>
<a src="/images" >go to images</a>
Q9. ¿Qué afirmaciones son verdaderas sobre el siguiente código??
enrutador.ruta('/imágenes/:_identificación', función () {
esto.renderizar('Hogar', {
datos: función () {
devolver imágenes.findOne({_id: this.params._id});} }); });
- Se renderizará la plantilla de Inicio.
- Si el usuario ve la dirección http://servidor local:3000/imágenes/123, el contexto de datos será una sola imagen que tenga el _id = 123.
- El contexto de datos para la plantilla será una sola imagen.
- Estamos definiendo una ruta a la que se pueda acceder vía http://servidor local:3000/Inicio cuando el servidor se está ejecutando en nuestra máquina local.
Deja una respuesta
Debes iniciar sesión o registro para agregar un nuevo comentario .