1) What is Koa?
Koa is a very small framework which provides us a minimal interface to build our applications. It is quite flexible and there are numerous modules available on npm for Koa.
2) What is Pug?
Pug is one of the most popular terse and templating language used with koa.
It is used to produce HTML and supports dynamic code and reusability.
3) What is npm in Koa?
npm stands for
Node
Package
Manager and it is the package manager for node. It is the collection of packages of open-source code for Node.js, mobile apps, front-end web apps.
4) What are the ways to install a package using npm?
There are two ways to install a package using npm are:
Globally: Used to install CLI based packages and development tools.
Locally: Used to install libraries and frameworks.
5) Which command is used to install a package globally using npm?
Command used is: $ npm install -g
6) Which command is used to install a package locally using npm?
Command used is: $ npm install
7) What is MongoDB and Mongoose?
MongoDB: It is an open-source document database which is used to store data.
Mongoose: It is an API for node.js which is used to access our database from our koa application.
8) What is Scaffolding?
Scaffolding is a set of tools which is used to create a skeleton for a web application.
We manually created our:
Public directory
Added middleware
Created separate route files etc
9) What are the functions provided by Mongoose for retrieving documents?
Functions provided by Mongoose for retrieving documents are:
Model.findById(id, callback)
Model.find(conditions, callback)
Model.findOne(conditions, callback)
10) What are the functions provided by Mongoose for updating documents?
Functions provided by Mongoose for updating documents are:
Model.update(condition, updates, callback)
Model.findByIdAndUpdate(id, updates, callback)
Model.findOneAndUpdate(condition, updates, callback)
11) What are the functions provided by Mongoose for deleting documents?
Functions provided by Mongoose for deleting documents are:
Model.remove(condition, [callback])
Model.findByIdAndRemove(id, [callback])
Model.findOneAndRemove(condition, [callback])
12) What are the benefits of including caching in your webapps?
Benefits of including caching in your webapps are:
Network costs decreases
Your website Speed and performance increases
If your client is offline, your content can be made available
13) Which command is used to install koa-router module?
Command used is: npm install --save koa-router
14) Which command is used to install koa-serve?
Command used is: $ npm install --save koa-static
15) What are the most commonly used middlewares in Kao?
The most commonly used middlewares in Kao are:
koa-router
koa-static
koa-compress
koa-bodyparser
16) Which command is used to install Yeoman?
The command used to install Yeoman is:
$ npm install -g yeoman
17) Which command is used to install pug?
The command used to install pug is:
$ npm install --save pug koa-pug
18) What is Redirection in Koa?
Redirection is very important when we creating websites. It is used to keep people out of restricted areas of your website. If there are some errors on your server, we should redirect them to the respective error pages.
19) Which command is used to install koa-logger?
The command used to install koa-logger is:
$ npm install --save-dev koa-logger
20) What is Koa-logger?
Koa-logger: It is the middleware which is used for enabling logging in Koa. If you get an error on a specific route or request, then Koa-logger should help you to figure out what went wrong in each of them.
21) What is Yeoman?
Yeoman: It is a scaffolding tool built for Node.js. This tool is used for building database-backed software applications. A scaffolding tool sets up all (public directory, added middleware and route files) things for us so that we can directly get started with building our application.
22) What is generator in Koa?
generator: It is a new JavaScript ES6 function that is used to stop code execution in between.
23) What is 'all' method in Koa?
It is a special type of method that is used to handle all types of http methods at a particular route.
24) What are the different types of routes used for URL building in Koa?
The different types of routes used for URL building in Koa are:
Dynamic routes
Pattern matched routes
25) What are the types of HTTP methods available in Koa?
The types of HTTP methods available in Koa are:
GET
POST
PUT
DELETE
26) What are Middleware functions in Koa?
Middleware functions: are functions that have access to the request object and the response object. They are used to modify request and response objects for tasks (parsing request bodies and adding response headers etc).
27) What are the uses of HTTP Cookies?
The uses of HTTP Cookies are:
User tracking
Personalization
Session management
28) What are the ways to transport data between client and server?
There are two ways to transport data between client and server is:
Cookies
URL parameters
29) Which command is used to install koa-session?
The command used to install koa-session is:
npm install --save koa-session
30) What is Compression in Koa?
Compression: It is an effective way to save bandwidth and speed up your site. It is only compatible with modern browsers.
31) Which command is used to install koa-compress?
The command used to install koa-compress is:
$ npm install --save koa-compress