►
From YouTube: How to Make gRPC Calls with Insomnia
Description
In this video, we’re going to build a fun and simple gRPC server in Node.js. Then we’ll demonstrate 3 ways to use Insomnia to make gRPC requests on our server. Try Insomnia and follow along: https://insomnia.rest/
For 3 more ways to leverage Insomnia for gRPC & all referenced docs and code, check out the blog tutorial: https://bit.ly/3itLM8N
▬▬▬▬▬▬ TIMECODES ▬▬▬▬▬▬
0:00 - Intro
0:40 - Build a gRPC Server With Node.js
5:35 - Send Requests With Insomnia
6:22 - Unary RPC
6:50 - Client Streaming RPC
7:38 - Server Streaming RPC
8:18 - Conclusion
#GRPC #APIs #APIdesign #APItesting #GetInsomnia #APIdev #APIdeveloper
A
Our
server
will
reach
out
to
the
free
open,
notify
api
to
get
information
about
the
international
space
station.
Returning
some
of
that
data
to
our
insomnia
client,
when
it
asks
because
the
focus
of
this
walkthrough
is
on
using
insomnia,
we're
only
going
to
review
our
different
pieces
of
server
code
rather
than
write
it
together
from
scratch.
A
A
The
space
station.proto
file
is
our
protocol
buffer
file,
which
gives
the
client
and
the
server
a
common
specification
for
communication.
Our
service
exposes
three
rpcs
three
methods.
We
have
a
get
astronaut
count
method.
The
client
sends
an
empty
request
body
and
the
server
sends
back
a
body
with
an
integer
called
count.
A
Next,
we
have
get
astronaut
names,
which
is
a
client
streaming
rpc.
In
this
method,
the
client
will
stream
in
a
list
of
astronaut
index
integer
values.
Once
the
client
commits
the
stream,
the
server
will
respond
with
a
single
string
called
names
which
will
be
a
comma
separated
string
of
astronaut
names
corresponding
to
the
index
values
given.
A
A
As
we
mentioned
earlier,
the
server
will
be
making
a
few
http
requests
to
open
notify
to
its
free
api,
with
up-to-date
information
on
the
international
space
station.
This
module
simply
abstracts
away
those
http
requests
by
using
axios
packaging
up
our
response
data
based
on
what
our
server
will
need.
A
Lastly,
we
put
all
the
pieces
together
in
server.js.
This
file
represents
the
server's
implementation
of
the
three
rpcs
defined
in
the
protocol
buffer
file
when
using
the
grpc
package
to
build
a
server.
We
add
a
service
that
corresponds
to
a
protocol
buffer
specification,
and
then
we
provide
an
implementation
for
each
of
those
rpcs,
an
rpc
implementation
when
called
receives,
call
and
callback
parameters
for
our
get
astronaut
count.
Implementation,
for
example.
We
don't
care
about
the
input,
so
we
ignore
the
call
parameter.
A
A
For
our
get
astronaut
names
implementation,
we
listen
for
on
data
events
from
the
client,
since
this
is
a
client
streaming
rpc
every
time,
there's
data
which
should
be
our
astronaut
index.
We
push
that
index
onto
our
list
of
index
values
that
we'll
need
once
we
get
an
on
end
event,
meaning
the
client
is
done
sending
index
values.
Then
we
call
our
helper
method,
get
astronaut
names
as
array
with
our
array
of
indices.
A
Lastly,
for
get
location
which
is
a
server
streaming
rpc,
we
first
call
the
axios
request
for
getting
the
current
location.
Then
we
call
call.right
passing
it
that
data
this
streams
back
our
first
response
from
the
server
to
the
client,
then
based
on
the
value
for
seconds
which
the
client
may
have
provided
in
the
request
body.
We
set
a
timeout
to
wait
that
many
seconds
and
then
do
this
all
over
again.
A
A
A
A
A
Next,
we'll
demonstrate
the
client
streaming
rpc.
For
that
we
choose
get
astronaut
names
from
our
method
list.
Then
we
click
start
at
this
point.
The
server
is
waiting
for
all
of
the
streamed
in
requests
from
the
client,
we'll
stream
three
pieces
of
data.
Our
request
body
is
an
object
with
an
index
value
we'll
set
the
index
to
3
for
our
first
request
and
add
it
to
the
stream.
A
Next
we
set
the
index
to
1
and
add
that
to
the
stream,
then
we'll
set
the
index
to
six
and
add
that
to
the
stream
with
those
three
requests
streamed
to
our
server.
We
click
on
commit
which
tells
the
server
that
the
client
is
done
streaming
in
data,
and
now
it
can
send
back
its
response
and
there
we
see
the
server
respond
with
the
names
of
the
astronauts
corresponding
to
index
values,
3,
1
and
6..
A
Lastly,
we'll
demonstrate
the
server
streaming
rpc
in
insomnia.
We
choose
the
get
location
method
from
our
list.
The
request
body
is
an
object
with
a
key
called
seconds,
we'll
set
seconds
equal
to
2..
By
doing
this,
we're
telling
the
server
that
we
want
its
stream
to
send
back
responses
every
two
seconds.
A
A
And
that
concludes
our
demonstration
of
using
insomnia.
As
a
grpc
client,
we
demonstrated
a
simple
grpc
server
to
handle
unary,
client
streaming
and
server
streaming.
Rpcs
insomnia
also
handles
bi-directional
streaming.
Rpcs,
though
we
did
not
cover
it
in
this
walkthrough
video.
Thank
you
for
joining
us.