0% found this document useful (0 votes)
6K views16 pages

Building Microservices With Node - Js

- API architecture helps with mobile modernization efforts by layering APIs on endpoints, allowing backend systems to connect directly to mobile apps through a consistent interface. This provides independence between development and deployment. - Challenges with microservice architectures include configuration management, debugging, and ensuring components are automated and perceptible. - To initialize a new Git repository, use the git init command. The git clone command makes a local copy of a remote repository and its entire version history.

Uploaded by

satish gowda
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
Download as xlsx, pdf, or txt
0% found this document useful (0 votes)
6K views16 pages

Building Microservices With Node - Js

- API architecture helps with mobile modernization efforts by layering APIs on endpoints, allowing backend systems to connect directly to mobile apps through a consistent interface. This provides independence between development and deployment. - Challenges with microservice architectures include configuration management, debugging, and ensuring components are automated and perceptible. - To initialize a new Git repository, use the git init command. The git clone command makes a local copy of a remote repository and its entire version history.

Uploaded by

satish gowda
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1/ 16

Description Correct An

Why does developing an "API architecture" help with mobile


modernization efforts? 1

What are the challenges you face while working Microservice


Architectures?

a. Automate the Components

b. Perceptibility

c. Configuration Management

d. Debugging 3

which is not a component of microservice architecture ? 1

which is not an advantage of Microservices Architecture. 6

How to output pretty html in Express.js? 2

Which is the correct format to Get Variables In Express.js using Get()


Method? 3

Which of the following code can create a web server? 1

How To Enable Debugging In Express App? 3


In ExpressJS, the method app.all(path, callback [, callback ...]) can
accept all HTTP methods 2
Can you build single-page, multi-page, and hybrid web applications
using Express Js? 1

The Git clone command does which of the following? 3


How does Git thinks of its data ? 1
You have a local repository but other team members have pushed
changes into the remote repositiory. which git operation would you
use to download those changes into your working copy 1
which command create a copy of the repository and a working
directory in the client workspace? 4
Which of the below commands attaches the remote repository to our
local repository? 1
Which of the following is the correct way to initialize a new Git
repository? 2

Which of the following is true about setTimeout(cb, ms) global


function? 3
Which of the following statement is valid to use a Node module fs in a
Node based application? 1

Which of the following is true about Chaining streams? 3

Which of the following is true about Piping streams? 4

Point out the wrong statement : 2

Which of the following will implicitly create the collection testData ? 2


Which of the following method corresponds to Order by clause in SQL
? 1
Which of the following method returns true if the cursor has
documents ? 2

What is the docker command to add or update a node label? 3


The Node.js modules can be exposed using _________ 3
Where does NodeJS runs? 2
Node.js is a _________ application but supports concurrency 1
NodeJS has inbuilt WebServer? 1
Which of the following statement is valid to use a node module in a
node based application? 1
MVC is an architecture for seperation of functionality within your
application 1
a file which Git has been explicitly told to ignore 3

choose proper syntax of schema based data model 3


to install node modules in node application run command 2
Mongoose is an object document modeling (ODM) layer that sits on
top of Node's MongoDB driver
1
Rest Api are develop and build using which of the following 1)
MongoDB 2) Mongoose 3) ExpressJs 4) Router 1

to send get request to webserver create endpoint url 3


app.use() is called only at first request send to server 2
_____________ function creates nodejs web server at specified port and host 4
express object includes method to define routes for get,post,put and
delete request . 1) get(), post() 2)put(), delete() 3) get(), update() 4)
post(), remove() 3
Is a friendly GUI application used as testing tool of Rest Api 3
to extract requestcbody data in node application middleware ------ is
used 2

What will be endpoint URL for given statement


app.delete('/removeuser/:Id',(req,res)=>{res.send("User Removed")}) 2
body parser provides four modules to parse different type of data
include 1) JSON 2) Raw 3) Text 4) URL Encoded form 1

which statement used to retrieve request body data in post request 3


Select correct advantage of templating Engine in Node.js. 1) Single
template for multiple pages 2) Improves productivity 3) fatster client
side processing 4) Improves scalibility
app.set('view engine','ejs') sets the default view engine for node.js
application without installing ejs module.
Which of the following is correct syntax to retrieve data from
database and print on page when using EJS template engile

Which one of given code approach suitable to render list of data in


node App using EJS view engine
<% if( user.username) { %> html render <% } %> this statement is
enable to render html when username is valid user.
Reusing layout on multiple pages which statement is correct in node
app

Code snipet to render page in browser

What is Oauth?
We can use Oauth with our Node.js Application using passport
module
correct strategy to login with facebook passport is . 1) Configuring the
session 2) Creating facebook strategy 3) creating route 4)
deserializing session
The passport.authenticate() is middleware with
arguments request,response to authenticate user with facebook or
google
To setup facebook strategy need to import node modules.
Which one not property of facebookStrategy object?
Tags (optional) Option 1 Option 2
The APIs connect directly to your
back-end systems It "layers" APIs on your endpoints

Only A, B ,D Only A, B, C

Servers Service Discovery

Independent Development Independent Deployment


app.set('view options", { pretty: app.set('view options', { pretty:
true }); true });

var express = require('express'); var app = express();

http.createServer(callback) http.createWebServer(callback)
On Linux the command would be On Windows the command
as follows:$ DEBUG=express:* would be:set DEBUG=express:*
node index.js & node index.js

1 0

1 0
Make a local copy of the
Creating a working directory repository
snapshot file

pull checkout
update checkout

git remote add origin <serverUrl> git remote add <serverUrl>

git add git init


The setTimeout(cb, ms) function
The setTimeout(cb, ms) global returns an opaque value that
function is used to run callback cb represents the timer which can
after at least ms milliseconds. be used to clear the timer.

var fs = require("fs"); var fs = import("fs");

Chanining is a mechanism to
connect output of one stream to
another stream and create a chain Chanining is normally used with
of multiple stream operations. piping operations.
Piping is normally used to get
Piping is a mechanism where we data from one stream and to pass
provide output of one stream as output of that stream to another
the input to another stream. stream.
Database is a physical container A single MongoDB server
for collections typically has single databases

while (var i = 1; i <= 25; i++) for (var i = 1; i <= 25; i++)
{ {
db.testData.insert( { x : i } ) db.testData.insert( { x : i } )
} }

sort() order()

hasMethod() hasNext()

docker node modify --set-label docker node update --set-label


module.expose module
Client Server
single threaded None of these
Yes No

var fs = require("fs"); var fs = import("fs");


1 0

traked untracked

let employeeSchema = new


let employeeSchema = Schema Schema (Date, Time, Boolean,
(Date, Time, Boolean, Number) Number)
npm u mongoose express --save npm I mongoose express

1 0

Only 2 and 3 Only 1 and 3

' Routes.get('/'); Routes.get('/','parameters');


1 0
app.use() app.get()

Only 2 and 3 only 1


Swagger Node App

node parser body parser

http://localhost:3000/deleteuser/123 http://localhost:3000/removeuser/123

all 1,2,3,4 only 1

app.post('/login', function(req, res) app.post('/login', function() {var


{var uname = uname =
req.username,upassword = body.username,upassword =
req.userpassword;}); .body.userpassword;});

4 only 1 only 2 and 3


2 1 0

2 {{ user. Username }} <%= user.username %>


<%shape.colors.forEach((color) => { %> <%shape.colors.forEach((color) => { %>
<% color %> <%= color %>
<% } ) %> <% } ) %>
2

2 1 0

4 <% layout.ejs %> <% include ./view.Layout/layout.ejs %>

app.get('/Login', (req, res) => app.get('/Login', (req, res) =>


{ res.render('login') ; { res.send('login') ;
2 }); });

It's a system where third party gives access


to it's information , commanly used for
4 It's Open authorization third party authentication

1 1 0

3 1,2,3,4 3,4,2,1

1 1 0
4 passport passport-facebook
3 ClientId ClientSecret
Option 3 Option 4 Option 5 Option 6
The APIs are inherently more
secure None of the above

All of the above mentioned None of these


Remote
Static Content Content Delivery network Services
None
Granular of
Fault Isolation Mixed Technology Stack Scaling these
app.set('view options', [ pretty: app.set['view options', { pretty:
true ]); true }];

app.get('/', function(req, res)


{/* req have all the values
**/res.send('id: ' + ________);}); app.listen(3000);
http.createHTTPServer(callbac
k) None of the above.

Both of above None of above

both 1 and 2 Commits a new branch


folder None of these

export commit
import clone
git remote connecct
<serverUrl> None of the mentioned

git commit None of the options

Both of the above. None of the above.

package fs; import fs;

Both of the above. None of the above.

There is no limit on piping


operations. All of the above.
Collection is the equivalent of
an RDBMS table None of the above

for (var i = 1; i <= 25; i++)


{
db.testData.inserts( { x : i } )
} none of the above

orderby() All of the above

hasDoc() All of the above


docker node update --label-
add docker node add --label
module.exports all of the above
Both of above None of above
Multiple threaded Double threaded
TCP/IP server exists None of the above

package fs; import fs;


ignored all of these

let employeeSchema = new


schema ({DateOfJoin:Date,
FullTime: Boolean, Salary
:Number, Name :{type : String,
required : true, unique : true}}) None of these
npm t mongoose express all of the above

Only 1, 2 and 3 all of the above


Routes.get('/',(req, Routes.get('/',
res)=>{ console.log('Home')}); ())=>{ console.log('Home')});

app.start() app.listen()

only 1 and 2 all of the given


Postman None of these

express middleware handlesbar

http://localhost:3000/delete/123 http://localhost:3000/user/123

only 4 and 4 None of given

app.post('/login', function(req, app.post('/login', function(req, res)


res) {var uname = {var uname =
req.body.username,upassword = req.username,upassword =
req.body.userpassword;}); req.userpassword;});

None of given option


all given options
< user.username > { user. Username }
<%shape.forEach((color) => { %> {{shape.forEach((color) => { }}
<%= color %> {{ color % }}
<% } ) %> {{ } ) }}

<% include ./View/Layouts/layout.ejs


%> <% include ./View/Layouts/layout %>

app.get('/Login', (req, res) => app.get('/Login', (req, res) =>


{ res.send.status('login') ; { res('login') ;
}); });

Used for validating user using third


party service all of the above

2,3,1,4 4,3,2,1

passport.use() only 1 and 2


done callBackUrl
Difficulty
Level

Easy

Easy

Easy

Easy

Easy

Easy

Easy

Easy

Easy

Easy

Easy
Easy

Easy
Easy

Easy

Easy

Easy

Easy

Easy

Easy

Easy

Easy

Easy

Easy

Easy
Easy
Easy
Easy
Easy

Easy
Easy
Easy
Easy

Easy
Easy

Easy

Easy

Easy
Easy
Easy

Easy
Easy

Easy

Easy

Easy

Easy

Easy
Easy

Easy

interme
diate
Interme
diate

Easy

Easy

Easy

Easy

Easy

Easy
Easy
Easy

You might also like