►
From YouTube: NodeJS CharlestonJS Meetup 2/25/2021
Description
Juan Fabrega talks about prisma and show a demo using prisma and basic crud operations.
C
B
Okay,
so
I'm
going
to
go
ahead
and
kick
it
off
my
name's
tom
wilson
kind
of
run
the
charleston.js
group-
and
this
is
our
first
virtual
meeting
of
the
new
format
for
2021
and
basically
we're
gonna-
be
meeting
weekly
every
thursday
from
five
to
five.
B
Thirty
ish
may
extend
if
if
we
want
but
just
30
minutes
kind
of
informal
15
to
20
minute
talk
and
then
lightning
talks
and
any
shout
outs,
and
this
week
we're
focused
on
node.js
and
then
next
week
we'll
do
react
and
then
the
following
week
I
think
dino
or
functional
programming
and
then
the
following,
swelt
and
view,
but
just
trying
to
just
give
everybody
kind
of
the
whole
variety
of
javascript
happy
to
add
more
things,
and
we
don't
have
to
just
talk
about
those
topics
but
just
trying
to
put
together
something
that's
more
virtual,
friendly
and
more
signaled.
B
So
please
give
me
some
feedback
either
via
the
meetup
or
discussion
board
or
or
you
can
hit
me
on
twitter
at
t.
Wilson63
are
a
number
of
other
places
to
find
me
or
email
me
at
tom,
at
hyper63.com
as
well
and
and
I'm
t
wilson
63
on
charleston
slack
too.
Today
we
have
juan
who's
going
to
talk
about
prisma,
and
this
is
our
node
course
so
he's
going
to
spend
a
few
minutes
showing
us
prisma,
which
sounds
really
cool,
and
I
will
let
him
sort
of
take
it
from
here.
A
Sorry
I
was
muted,
but
thanks
tom
for
that
yeah
and
definitely
psyched
to
be
giving
this.
This
talk
to
anybody
who
will
listen
and
yeah.
I
guess
it
is
the
first
one
of
the
year,
so
no
pressure
but
yeah
we'll
try
to
try
to
make
it
cool
here
so
yeah.
So
for
anybody
not
familiar,
I'm
gonna
go
through
kind
of
a
very
quick
intro
to
just
just
talking
about
prisma
a
little
bit
and
then
get
into
a
into
a
demo.
A
So
I
really
want
to
focus
most
of
the
time
on
the
demo
and
then
potentially
a
q
a
after,
and
if
anybody
has
any
questions
in
the
middle
of
the
talk,
please
feel
free
to
interrupt
me.
So
no,
no
worries
there.
I
mean
maybe
maybe
not
interrupt,
but
I
don't
know
I
don't
know
what
the
best
format
is.
But
yeah.
If
you
have
a
question,
just
just
ask
it:
I
guess
all
right
so
yeah.
A
So
what
what
is
prisma
so
christmas
first
was
an
orm
and
I
think
I
would
it
would
be
good
to
start
with
an
idea
of
what
an
orm
is
for
anybody
who
isn't
familiar.
I'm
betting.
Most
people
are,
but
for
anybody
who
isn't
familiar
it
stands
for
object,
relational
mapping
and
it
basically
for
most
people
it's
a
basic.
A
It's
essentially
a
data
layer
that
lives
in
the
in
an
application
that
allows
you
to
interact
with
your
actual
data
database
using
native
application
language
that
you
that
you
use
in
the
application
and
also
modeling
relationships
in
that
language,
usually
right.
So
this
is
a
quick
quick
example,
so
you
know
where
you
would
have
a
query
or
wraps
typically
have
query
builders
that
allow
you
to
build
things
that
look
like
this,
so
it's
all
made,
for
example,
if
you're
building
in
javascript,
this
is
all
native
javascript.
A
So
that's
that's
the
basics.
Now
I
think
it's
kind
of
hard
to
get
away
from
the
the
fact
that
arms
are
really
highly
divisive
in
the
industry.
Some
people
swear
by
them.
Some
some
very
many
people
dislike
them,
but
I
mean
honestly,
I
think
it's
just
about
what
works
for
everybody
and
what
works
for
you
and
your
team
when
you,
when
you
decide
to
pick
something
like
this
and
these
days,
most
rms,
including
prisma,
have
escaped
patches.
A
Oh
sorry,
I
thought
somebody
had
a
question,
but
I'll
just
keep
going
all
right.
So
why
use
an
orm
at
all
a
lot
of
reasons?
Number
one.
Is
you
probably
stuck
at
sql,
that's
kind
of
why
I
picked
it?
No
I'm
just
kidding
I.
I
do
believe
that
there
are
people
who
who
chooses
it
because
they're
terrible
at
sequel,
but
I
would
not
make
this
so
some
of
these
reasons
I
want
to
call
out,
because
I
don't
think
there
are
good
reasons
to
use
an
rm.
A
So
if
you're
terrible
at
sql,
that's
probably
not
the
best
reason
just
to
pick
up
on
rm,
because
then
you're
just
going
to
continue
to
be
terrible,
it's
equal
forever
and
ever
now
I'm
not
a
master
at
sequel,
but
I
think
I
could
I
could
make
something
work,
even
without
an
orm.
So
I'm
not
too
worried
about
that.
So
a
real
reason,
I
think,
is
that
you
want
to
model
your
database
as
objects
or
something
that's
native
to
the
application
language
that
you're
using
and
also
map
their
relationships.
A
So
to
me,
that's
a
valuable
thing
to
have
is
a
mapping
of
all
data
relationships
in
the
application
code
that
you
can
actually
look
through
and
interact
with
using
native
languages
that
are
using
the
language
of
your
application.
So
that
to
me
is
a
pretty
good
reason
to
use
it.
Another
reason
is
you
want
to
easily
generate
dynamic
queries
without
worrying
about
sanitizing
input,
so
I
think
this
is
also
a
pretty
compelling
reason.
A
Specifically,
the
dynamic
queries
part
as
well
as
having
those
queries,
be
again
in
the
in
the
domain
language
that
you're
using
not
having
to
go,
maintain
long,
sql,
query,
query,
strings
or
templates
or
stuff
like
that.
That
can
get
out
of
hand
when
things
get
complicated,
so
that
to
me
is
a
pretty
compelling
reason.
Of
course,
you
should
also
learn
to
sanitize
them,
but
so
yeah
that
one's
a
bit
of
a
compromise.
But
you
know
when
you're
to
me.
A
If
there's
any
question,
I
would
rather
have
the
system
do
it
for
me
just
in
case
you
know
just
in
case
I
make
a
mistake
so
and
then
the
last
one
is
you
want
to
be
able
to
swap
databases
while
maintaining
your
data
access
layer
intact.
So
to
me
this
falls
into
the
bad
reason
camp
and
I'm
not
sure
how
to
delineate
these.
Maybe
we
can
just
mark
them
with
red
text
and
say
this
is
bad.
A
Don't
don't
don't
make
this
a
reason
to
use
an
rm
because
a
you're
not
going
to
be
able
to
do
that?
If
you
decide
to
swap
databases,
then
the
likelihood
is
that
you're
going
to
have
to
make
changes
to
your
rm
layer
as
well,
because,
even
though
most
rms
support
very
many
databases
with
the
same
language
considerations,
they
they
do
have
different
quarks
and
edge
cases
for
each.
And
if
you
have
a
very
complex
application,
I
would.
A
I
would
bet
that
you
were
going
to
run
into
most
of
those
edge
cases
from
swapping
databases.
Also,
I
I
don't
know
how
common
this
the
database
swap
of
an
entire
application
is
some
people
here
in
this
room
may
have
done
it
very
many
times.
I
personally
have
never
done
it.
I
have
added
data
data
access
points,
I've
added
different
databases
to
an
application,
as
time
goes
on
for
different
use
cases.
A
I
don't
think
I've
ever
swapped
out
an
entire
data
access
layer
in
one
cell
swoop,
and
I
don't
I
would
not
advocate
for
a
complete
rewrite
in
that
passion
myself.
But
you
know
I
don't
know
how
everybody
else
still
hears
here
feels
so
again.
I
wanted
to
call
these
reasons
out
in
case
you're
thinking
about
using
nrm,
and
that's
one
of
the
reasons
I
personally
don't
think
that
should
be
that
and
also
you
sucking
at
sequel.
I
don't
think
that
should
be
a
reason.
A
So
that's
my
that's
my
thought
there
all
right.
So
if
you
are
going
to
use
an
rm,
there's,
obviously
a
lot
of
choices,
christmas,
one
that
I've
gone
with
for
some
recent
projects
and
I'm
just
going
to
talk
a
little
bit
about
what
it
is.
So
it
is
the
easiest
way
to
describe
it.
Is
that
it's
the
type
type
script
first
orm,
and
it
includes
a
few
things,
so
it
includes
number
one-
is
schema
generation
from
your
database
schema.
A
So
personally,
I
find
this
to
be
really
ergonomic,
really
useful,
just
just
really
great
to
work
with
so
personal
will
introspect.
They
call
it
introspection
your
database
that
you
give
it
and
generate
a
schema
for
you.
So
I
find
that
to
be
really
cool.
I
like
it
a
lot,
and
I
continue
to
use
it
to
this
day.
Some
cases
you
need
to
modify
your
schema
manually
but
having
the
schema
be
generated
by
prisma
as
a
first
pass
is
really
helpful,
especially
when
you
have
a
really
large
database.
A
So
next
up
is
a
relational
data
model,
so
the
schema
will
include
relationships
based
on
what
it
introspects
and
that
model
will
be.
Those
relationships
will
be
available
to
you
when
you
actually
use
when
you're
actually
interacting
with
your
database.
So,
for
example,
you
you
will
know
which
relation
the
user
user
row
has
based
on
what
the
schema
is
and
you'll
know
that
in
your
editor
as
you're
typing,
which
is
amazing.
So
I
personally
really
like
that
and
then
type
safe,
query
building.
A
I
mean
in
the
hundreds
of
typings
data
types,
typescript
data
types
specifically
about
your
data,
so
it
knows
which
arguments
certain
functions
take
so,
for
example,
creating
a
resource
has
a
specific
set
of
arguments,
finding
resources,
a
specific
set
of
arguments,
and
once
those
types
are
generated,
the
client
is
really
a
breeze
to
use,
because,
as
soon
as
you
start
typing,
you
essentially
know
what
lives
somewhere
and
what
is
optional.
What
is
not
optional,
what
types
each
thing
supports
it
doesn't
support
what
what's
nullable
et
cetera,
et
cetera.
A
So
once
you
have
that
you
know
things,
things
really
become
really
easy,
so
so
yeah,
that's
that's
kind
of
a
a
quick
overview
of
that.
So
the
last
light
I
had
is
as
well
white
prisma.
I
think
I
kind
of
covered
that
in
the
what
what
is
prisma
so
really
the.
What
I
want
to
talk
about
here
is
just
why
why
why
I
chose
it
and
really
it
just
goes
back
to
these
things.
A
So
I
would
say
for
me
personally
that
one
of
the
main
reasons
was:
I
have
picked
up
typescript
pretty
heavily
both
at
work
that
I've
worked
in
my
personal
projects
and
recently
I
started
just
a
hobby
project
and
in
typescript
and
was
having
a
hard
time
finding
a
typescript
first
or
that
would
actually
type
check
my
database
layer.
So,
finally,
I
found
prisma
and
you
know
it's
still
kind
of
in
its
infancy.
A
But
you
know
this
is
a
hobby
project,
so
I
decided
to
take
the
plunge
and
go
for
it
now.
Christmas
from
my
understanding
is
used
in
production
very,
very
many
companies,
so
I
think
it
is
definitely
production
safe.
It's
to
the
point
where
it's
mature
enough,
but
I
I
would
say
there
are
a
few
things
that
would
make
it.
D
Yeah,
so
I
was
looking
into
building
a
small
web
app
last
year
and
I
was
looking
a
lot,
the
prisma
and
smaller
rms,
but
I
was
moving
a
little
bit
towards
using
as
my
database
and
I
didn't
really
see.
The
purpose
of
using
I
mean
prisma
doesn't
really
support
mongodb
at
the
moment,
but
is
there
any
point
in
using
an
orm-like
prisma
for
a
non-relational
database.
A
Yeah,
I
I
think
I
think
you
could
apply
something
very
similar.
I
don't
know
that
it
exists
personally,
but
I've
used
mongoose
in
the
past
when
working
with
mongodb.
A
I
don't
know
if
there
is
a
typescript
or
type
safe
version
of
mongoose
and,
as
you
said,
I
don't
know
that
it
would
be
as
useful
in
a
in
a
nosql
database,
because
nosql
schemas
are
notoriously
difficult
to
make
strict
or
to
or
to
rely
on
the
strictness
of,
I
should
say
so
yeah.
I
guess
that's
it's
hard
to
say
I.
I
still
think
that
using
an
aura
was
useful
for
me
when
I,
when
I've
worked
with,
I
I
found
mongoose
to
be
useful.
A
I
I
would
not
say
it's
as
useful
as
as
prisma,
for
example,
and
in
many
cases
I've
seen
people
kind
of
build
their
own
data
access,
layers
and
kind
of
like
query
formats
for
that
they
kind
of
roll
on
their
own.
It
seems
pretty
easy
to
do
it
that
way
as
well.
Okay,
awesome
anybody
else.
A
Let
the
faq
just
in
case
anybody
we
can
go
through
this
at
the
end,
when
you
know
we
kind
of
have
a
q,
a
section.
It's
really.
I
think
this
is
probably
gonna
answer
your
question
better
than
I
can
in
most
cases,
but
I
also
want
to
call
out
what
peyton
said
so
there
yeah
there
is
no
support
for
prison.
It's
only
for
relational
data
base
at
this
time.
A
So
if
you
work
with
nosql
databases,
this
is
probably
not
going
to
help
you
right
off
the
bat
and
hopefully
you
move
to
a
sql
database
at
some
point
and
enjoy
the
really
really
hard
migration
process,
all
right,
so
yeah.
So
let's
let's
go
through
this,
so
I
have
a.
I
have
a
local
database,
it's
a
poster
database
and
it
has.
I
was
thinking.
Maybe
we
could
start
from
scratch,
so
you
guys
can
see
the
process.
So
what
I'm
going
to
do
is
I'm
actually
going
to
delete
all
these
tables?
A
I
have
a
users
table
a
post
table
and
a
likes
table,
so
users
have
posts
and
posts
have
likes.
It's
pretty
pretty
basic.
I
feel
like.
I
can
recreate
this
pretty
quickly
on
the
spot
without
making
any
mistakes,
but
just
as
I
said
that
I'm
probably
going
to
make
a
lot
of
mistakes,
let's
go
ahead
and
do
that
so
I'm
going
to
go
ahead
and
delete
this.
A
This
table,
if
I
can
there,
we
go
and
there
we
go
so
now.
My
database
has
nothing
which
is
always
fun,
so
here
we
go,
and
so
here
I
have
actually
created
a
template
project.
All
the
code
is
written
already.
I
definitely
didn't
want
to
go
through
and
write
all
this
code
in
the
middle
of
the
demo.
That
would
have
been
too
time
consuming,
but
it's
a
basic
express
server
and
we're
going
to
ping
it
using
postman
just
to
show
how
things
work.
So
I
have
a
bunch
of
by
the
way.
A
Is
this
too
zoomed
out?
Should
I
maybe
do
this.
A
Is
that
just
a
little
bigger
yeah?
That's
better
sweet!
If
anybody
still
can't
see
it,
let
me
know-
and
I
will
zoom
in
and
zoom
in
more
all
right,
so
yeah.
So
here
it's
it's
a
basic
express
server.
I
have
a
list
of.
I
have
a
folder
just
with
some
controllers
and
routers,
I'm
just
using
a
quick
like
a
router
controller
pattern
here,
nothing
really
too
crazy
and
I
have
no
validation,
no
authentication.
None
of
that.
Just
we're
just
going
to
make
some
some
posts
to
our
to
our
express
server.
A
So
we're
going
to
make
it
easy
now.
The
first
thing
that
you'll
notice
is
that
in
my
database
folder
there's
a
folder
called
called
prisma,
and
here
we
have
a
file
called
schema.prisma,
and
here
we
have
a
little
prisma
logo
on
icon.
This
is
so
there
is
a
vs
code
extension
to
help.
You
write
your
christmas
schema,
so
as
you
type
you
can
kind
of
see,
for
example,
if
I
want
to
make
a
relation
here
in
the
schema
it'll
actually
help
me
out
by
auto
completing
based
on
what
it
knows
from
the
schema.
A
Now.
This
schema
that
you
see
right
here.
I
had
generated
just
as
testing
out
the
stuff
that
I
was
going
to
do
in
the
in
the
talk,
but
we're
going
to
go
ahead
and
delete
it
because
there's
no
data
in
our
database,
so
there's
obviously
no
schema,
so
it
shouldn't
know
any
of
this
stuff
in
theory
right.
So,
if
we
run
the
way
you
generate
a
schema
is
by
running
the
command
prisma
generate.
Now
I
have
a
alias
with
an
npm
script,
so
I'm
gonna
run
it
here,
prisma
introspect.
A
This
is
going
to
actually
look
at
my
database
based
on
the
environment,
variable
and
then
see
what's
in
there,
and
it
should
find
nothing.
It
should
say
you
have
nothing.
So
what
are
you
trying
to
do
here?
Dude
yeah,
so
there
we
go
so
there's
basically
nothing
in
the
table
and
it
just
errors
out.
A
So
no,
no
tables,
sorry,
nothing
in
the
database.
So
that's
what
it
does.
That's
pretty
simple
just
just
want
to
show
real,
quick.
What
that
command
actually
looks
like
so
prisma
generate.
Just
looks
like
this.
This
is
prisma,
has
a
cli,
so
I've
just
aliased
the
prisma
generate
command
with
my
schema
and
my
source
file
and
everything
to
my
my
into
an
npm
script.
But
it
really
generally
would
look
something
like
this
all
right.
So
let's
go
ahead
and
add
a
table.
A
Let's
add
our
users
table
a
new
table,
I'm
gonna
go
through
the
ui
just
so
just
so.
Things
are
super
super
clear
in
terms
of
what
we're
doing
and
we're
going
to
call
this
users
and
we're
going
to
add
some
columns.
A
The
user
is
going
to
have
a
first
name,
I'm
just
going
to
make
it
text,
I'm
not
worrying
about
data
types
or
whether
I'm
going
to
accept
x,
characters
or
whatever
just
going
to
make
it
text
and
be
done
with
it,
and
then
we're
going
to
have
a
last
name
and
that's
going
to
be
text.
So
one
thing
I'm
going
to
try
out
here
just
so
you
guys
can
take
a
look.
A
Is
let's
say
the
first
name
is
going
to
be
required
and
the
last
name
is
not
going
to
be
required
and
let's
go
ahead
and
save
that
all
right.
So
now
we
have
a
table
and
we're
going
to
go
ahead
and
run
our
introspect
command.
Once.
A
A
We
have
a
question
mark
here
next
to
last
name
because
that's
optional,
and
that
was
pretty
simple
now
one
thing
that
you
also
notice
so
for
anybody
who
does
javascript,
I'm
assuming
everybody
here,
because
you're
in
a
node.js
meetup,
most
99
of
people
who
are
building
things
in
javascript
are
using
camel
case
and
postgres
definitely
prefers
snake
case.
You
know
that's
kind
of
the
best
practice
if
you're
using
postgres
everything's
in
snake
case.
A
So
this
is
one
of
the
nice
little
abstractions
that
you
have
when
you're
using
an
orm
is,
you
could
actually
just
say.
I
want
this
to
be
called
last
name
and
I'm
going
to
go
ahead
and
map
it.
Map
is
a
function
of
prisma
and
I'm
going
to
map
it
to
last
name
cool.
So
now
it's
going
to
actually
find
the
last
name
row
in
the
database,
but
when,
when
I'm
in
my
application,
I
can
actually
just
use
this
little
last
name:
okay,
it's
just
a
nice
little
ergonomic
change
there.
A
So
one
of
the
one
of
the
things
that
I
discovered
is
is,
though,
when
you're
going
through
this
hey,
you
don't
want
to
do
this,
every
single
for
every
single
property
when
you
have
hundreds
and
hundreds
and
hundreds
to
take
in
data
attributes
on
tables
right.
So
there
is
actually
a
schema
transformer
for
prisma
we're
going
to
go
ahead
and
run
it
because
I
already
have
it
installed
in
alias
to
a
script,
so
npm
run,
transform.
A
Schema
and
that
is
going
to
do
exactly
what
we
wanted
to
do,
which
is
it's
going
to
camel
case
all
of
our
attributes,
map
them
to
the
correct
column
and
then
also
it
pascal
cased,
our
model,
which,
again
this
is
just
best
practice
like
things
that
people
are
used
to
that's
what
I'm
used
to.
So
that's
what
I
like.
So
that's
what
I
did
and
it
maps
into
the
users
table.
A
So
that's
what
we've
got
now,
let's
go
ahead
and
try
to
run
a
query
now
that
we
have
an
actual
schema,
so
the
queries
are
going
to
be
in
our
user
controller.
Typically,
I
would
build
a
service
to
make
queries
from
controllers,
but
again
this
is
just
for
demo
purpose,
so
we're
going
to
run
our
queries
directly
in
our
in
our
in
our
controller.
A
So
here
the
format
of
running
a
premium
christmas
query
is
you
essentially
import?
The
client
and
prisma
will
know
from
the
client
what
entities
you
have
and
which
queries
you
can
perform
in
those
entities.
So
one
of
the
things
that
you'll
notice
here
is,
if
I
go
to
users,
this
is
all
this
all
seems
to
be.
Okay,
however,
going
to
posts,
it
still
seems
to
be
okay,
but
I
know
that
I
have
no
posts
in
my
schema
now.
Why
is
that?
Why
is
it
not
giving
me
an
error?
Is
this
supposed
to
be?
A
Typescript
is
supposed
to
know
if
I
actually
have
a
post
entity
in
my
prismaclient.
The
reason
it
doesn't
know
is
because
I
haven't
generated
an
updated
client.
So
if
you'll
recall
I
go,
I
went
ahead
and
deleted
the
whole
schema
from
our
schema
file.
However,
the
prismaclient
does
not
get
updated
automatically.
You
can
actually
create
a
post,
install
script
that
runs
whenever
you
change
the
schema
and
it'll
create
a
new
client
for
now
we're
going
to
do
it
manually,
because
I
want
to
show
every
every
little
step.
A
A
So
let's
give
it
a
second
to
update
and
typescript
is
doing
its
thing
and
eventually
it's
going
to
throw
an
error
here,
because
this
doesn't
exist.
At
least
if
I
hit
right
we'll
see.
A
Or
maybe
typescript's
not
running,
because
I'm
because
my
zoom
is
using
on
my
cpu-
it's
also
a
possibility.
Oh
there
we
go.
Finally
did
it
alright,
so
we
have
an
error
here
yeah.
So
this
is
the
error,
so
I
have
a
query
that
actually
tries
to
find
my
users
posts
and
their
likes.
Those
don't
exist
anymore.
I
deleted
them
from
the
database.
So
let's
go
ahead
and
comment
this
out
and
we'll
get
rid
of
that
error.
Let's
see
what
else
we
have
other
errors
here.
A
C
A
A
Save
and
we're
gonna
we're
gonna
we're
gonna
get
back
to
it
once
we
generate
those
tables
all
right,
so
first
we're
gonna
start
with
our
users.
We
still
have,
I
believe,
an
error
here,
somewhere
nope,
no
errors
here.
Oh
there
is
one
error.
Oh
I'm
trying
to
find
user
posts.
We
can't
find
user
posts
because
there
are
no
posts.
A
A
Okay,
our
user
router-
this
doesn't
exist,
but
this
is
one
of
the
cool
things
about
tyscript
right.
I
don't
know
if
anybody
here
has
not
or
has
worked
with
typescript,
but
essentially
you.
If
you
mess
something
up,
you
know
right
away
and
it
just
tells
you
exactly
where
the
mistake
is
really
easily.
So
now
I've
fixed
all
of
my
typescript
mistakes
and
we
are
ready
to
start
our
server
and
ping.
The
postman,
let's
see,
let's
take
a
look
at
that.
A
A
A
A
A
A
The
query
looks
like
this,
so
prisma
dot
user
dot
find
many
now
find.
Many
is
basically
where
you
would
stick
any
condition
that
matches
based
on
the
users
you
want
to
find
so,
for
example,
find
many
where
first
name
is
john
or
where
last
name
is
cash.
Or
what
have
you?
However,
if
you
stick
nothing
in
it,
it's
just
going
to
find
every
single
user,
that's
in
that
collection
or
in
that
in
that
table.
A
A
We
want
to
create
we're
going
to
get
rid
of
the
email
because
I
actually
did
not
create
the
table
with
emails
and
it's
just
going
to
be
first
name
and
last
name
all
right,
and
so
we're
going
to
hit
our
users
endpoint
with
a
post
request
and
let's
take
a
look
at
what
that
query
looks
like
I'm,
going
to
go
ahead
and
hide
the
possibility
that
we
don't
need
that
much
anymore,
and
here
we
have
a
create
user
function,
which
will
take
first
name
and
last
name
from
the
body
here
it
is
console
log,
and
this
is
how
you
create
something
in
prisma.
A
So
let
me
just
go
ahead
and
write
it
from
scratch
and
you
guys
can
see
what
that
looks
like
so,
let's
say
create.
So
when
I,
when
I
start
typing
first
of
all,
prisma.
A
I
have
a
variety
of
things
that
I
can
do
here
are
my
resources
as
well.
So
you
can
see
users
right
here
and
then
I
can
do
any
amount
of
operations
on
my
user.
You
can
see.
All
of
them
here
find
delete,
aggregate,
create
count.
Obviously,
there's
aggregation,
queries,
there's
grouping,
etc,
etc.
So
let's
go
ahead
and
just
use
our
create
query
and
it's
going
to
tell
me
exactly
what
it
takes.
So
it
takes
a
data
object.
Now
the
data
object
is
what
has
the
data
for
the
user?
That's
pretty
self-explanatory.
A
So
let's
go
ahead
and
add
it
it's
an
object.
It
has
a
data
key
and
here,
let's
see
what
it
tells
us
about
the
data
for
that
user.
First
of
all,
we
have
an
error,
so
is
missing
the
following
properties:
it's
missing
an
id
and
it's
missing.
First
name,
it's
not
missing!
Last
name,
because
last
name
is
optional.
We
mark
that
as
optional
in
the
database,
and
that
is
missing
an
id
and
first
name.
A
So,
let's
go
ahead
and
say
id
we're
going
to
just
generate
that
using
uuid,
b4,
easy
pc
and
we
still
have
an
error
in
our
data
because
we
don't
have
a
first
name.
So
let's
go
ahead
and
add
the
first
name
and
that's
just
gonna-
that's
just
shorthand
because
we
already
declared
it
up
here
and
it's
gonna.
Take
it
right
from
the
body
now.
This
is
not
red
anymore,
we're
looking
good.
We
can
create
a
user
with
just
the
first
name.
A
Go
back
to
postman
make
sure
that
our
build
is
running.
Okay.
Our
server
is
up
again-
and
here
is
our
query:
posting
users
we're
going
to
create
user
jimmy
page.
Here
we
go
cool,
we
have
a
user,
his
user,
his
last
name
is
there
etc,
etc,
and
now
we're
going
to
query
our
users
collection
again
and
now
we
have
an
array
of
users
that
includes
our
user,
jimmy
page
easy-peasy,
all
right
so
far,
so
good!
A
Next
up,
let's
add
a
post
table.
Our
users
are
going
to
have
posts.
So,
let's
see
what
these
posts
should
have,
let's
go
to
our
postgres
database
create
a
table.
A
Obviously,
if
you're
doing
this
in
real
life,
you
probably
run
a
script
create
all
these.
You
run
a
bunch
of
sql
scripts,
but
we're
not
doing
that
because
we're
terrible
with
sql.
That's.
Why
we're
using
an
org
all
right
id.
A
A
A
A
Yes,
thank
you.
I
can't
see
who
said
that,
but
but
I'm
glad
somebody's
participating
all
right.
Let's
do
that.
Let's
regenerate
our
schema.
I'm
gonna
delete
this.
You
don't
really
have
to
delete
the
schema.
I
don't
know
I
have.
I
just
do
it
because
I'm
ocd,
but
let's
do
mpm,
run
prisma
introspect.
A
Cool
now
we
have
posts
and
we
have
users.
Now,
let's
take
a
look
at
what
that
looks
like
right.
First
of
all,
let
me
transform
it
because
it
looks
prettier,
so
npm
minus
transform
schema
all
right
awesome.
So
we
know
we
have
our
posts
here.
Obviously
it
has
a
title
description.
It
has
a
user
id,
but
it
also
has
a
user.
Now.
This
is
a
completely
virtual
piece
of
data.
Obviously
this
doesn't
exist
in
the
table.
We
don't
have
a
whole
user
object
in
the
table.
A
This
is
relation
to
us
which
is
created
for
us
by
prisma
and
if
we
decide
to
pull
it
into,
if
we
decide
to
make
a
query,
we
can
decide
whether
or
not
we
want
to
include
that
user
as
the
result
of
that
query,
which
is
really
simple
and
also
very
cool,
and
then
here
user
has
now
been
given
posts,
which
is
an
array
of
posts,
post
right,
so
again
same
deal.
A
If
I
pull
my
user
now,
I
can
decide
whether
or
not
I
want
to
include
posts
for
that
user,
and
that
goes
for
everything
else
that
goes
down
the
the
relational
line.
I'll
talk
I'll
I'll
kind
of
show
that
a
little
bit
later
so
let's
go
and
now
generate
our
client.
A
Just
keep
in
mind
that
all
of
these
things
would
be
running
mostly
in
the
background
once
you
have
an
application
deployed
like
all
these.
All
these
scripts
are
gonna
essentially
be
running
by
by
ci
pipelines
right
all
right.
So
now
we
should
have
a
new
schema.
Now
we
should
have
a
post
entity
in
our
in
our
in
our
client.
So
let's
go
ahead
and
see.
A
If
that's
true,
let's
uncomment
all
of
our
post
related
code,
I
don't
see
any
errors
so
far,
which
means
that
I
think
we're
good
and
let's
go
ahead
and
uncomment
our
post
router.
So
we
can
make
requests
and
create
posts.
A
All
right
awesome:
let's
go
ahead
and
go
to
postman.
I
think
we
should
be
good
to
go
so
in
postman
same
deal.
We
have
a.
We
have
a
get
request
to
get
all
posts,
let's
go
ahead
and
do
that.
Oh,
you
know
what
I
forgot:
I'm
not
running
the
server.
Let's
go
ahead
and
run
it.
A
Okay,
that's
running
and
we're
going
to
get
our
posts
and
we
have
no
posts.
Obviously
we
haven't
created
any
posts,
so
let's
go
ahead
and
create
one.
We
need
a
user
id
to
create
a
post
because
posts
require
user
ids.
So
here
is
a
post
we're
going
to
replace
this
user
id.
A
This
is
our
post
endpoint
for
posts,
posting
posts
and,
let's
take
a
look
at
the
query.
It's
going
to
be
pretty
much
exactly
the
same
as
our
user
query.
We
have
prisma.post,
oh
that's,
not
it!
This
is
it
prisma.post.create
and
then
we
pass
a
data
based
on
exactly
what
we
need
now.
This
is
new.
It's
a
new
syntax.
I
don't
think
anybody's
seen
that
because
it's
new,
so
let's
talk
about
that,
I'm
going
to
write
it
from
scratch
like
we
did
before.
A
A
Typescript
does
it,
but
I
don't
know
I
don't
know
who's
in
charge.
I
don't
know
all
right,
so
it's
obviously
failing
because
it
needs
all
this
stuff
that
is
obviously
necessary.
Like
an
id.
You
can't
create
anything
without
an
id
that
makes
no
sense
all
right
and
then
we're
going
to
need
a
title
which
is
going
to
be
the
title
that
I'm
destructoring
above
here
in
the
body.
A
Then
the
description
I
don't
know-
and
lastly,
we
need
to
give
it
a
user
id
now
here's
something
interesting.
It
doesn't
really
fail
if
we
don't
give
it
a
user
id.
Why
is
that
anybody
care
to
venture
a
guess?
It's
because
I
made
a
mistake
by
the
way.
A
A
A
Okay,
now
yeah
now
it
doesn't
have
a
question
mark.
So
that's
good
and
we're
going
to
do,
transform,
schema
and
we're
going
to
generate
our
client.
A
And
now
we're
gonna
run
our
server
all
right.
Let's
go
back
to
our
post
controller.
We
were
finishing
writing
up
this
query.
Now.
It's
still
not
throwing
an
error
again.
It
takes
a
little
bit
for
my
computer
to
kind
of
catch
on
this
when
it's
under
heavy
load,
but
it
will
error
out
and
tell
me
that
actually,
oh
there,
it
is
so
property
user
is
missing
so
yeah.
It
needs
to
have
a
user
related
to
the
post.
Let's
go
ahead
and
add
that,
so
how
do
we
add
our
relation?
A
This
is
pretty
interesting,
so
it's
basically
connecting
an
existing
resource
in
your
database.
So
there
is
a
connect
statement
and
you
connect
it
where
id
is
user
id.
So
what
this
is
doing
is
saying:
hey
what
user
id
you
gave
me
in
the
body?
That's
the
user
id
I'm
going
to
use
to
connect
on
the
id
field
for
this
for
this
resource.
So
the
other
thing
you
can
do
is
you
can
actually
create
the
resource
if
you
don't
have
it.
A
So
if
you
wanted
to
run
a
request
where
your
user
is
creating
an
account,
for
example,
because
they
want
to
post
something
so
I'm
on
a
website
hey,
I
want
to
post
something,
but
I
don't
have
an
account.
I
write
the
whole
post.
It
lets
me
write
the
post
as
a
guest
and
when
it's
time
to
post
it
it
says.
Oh
now,
you
need
to
create
an
account.
A
We
can
do
both
those
things
here
at
the
same
time
and
say,
create
a
post
and
then
there
is
a
create
create
statement
which
you
can
actually
pass
data
to.
So
you
could
say
create
you
can
see
it
auto
completes
this
right
here
and
it
will
tell
you
exactly
what
you
need
to
create
a
user,
so
we're
going
to
create
a
user.
Okay,
we're
not
going
to
do
this,
I'm
just
going
to
show
you
what
it
looks
like,
and
it
says
this
is
missing.
A
A
A
I
personally
use
these
a
bunch
to
create
resources
that
have
nested
relations,
so,
for
example,
if
you're
creating
an
invoice
and
the
invoice
has
items
so
you
you
can
create
both
at
the
same
time
and
they're
gonna
essentially
be
connected
via
the
create
statement
pretty
nifty.
For
now
we're
gonna
stick
with
connect,
because
that's
what
we're
doing
here.
D
Excuse
me:
that's
just
for
foreign
keys
between
relations
of
different
tables.
That's
correct!
Yes,
awesome!
That's
pretty
cool!
I
actually
like
this
in
text.
A
lot.
A
Yeah,
it's
it's.
I
agree
with
that.
It's
very
cool!
Personally
I
like
it
there's
one
thing
that
I've
found
I'll
just
kind
of
call
this
out,
just
because
it's
funny
but
create
new
lines.
A
If
you're
working
with
prism
a
lot
get
used
to
creating
new
lines,
because
in
some
cases,
you'd
be
tempted
to
continue
to
write
one
liners
like
this,
and
then
you
realize
you
have
like
seven
brackets
kind
of
next
to
each
other,
so
that
can
be
kind
of
an
eyesore,
so
yeah
again
the
habit
of
creating
new
lines
and
things
get
easier.
I'm
not
gonna
do
that
now
because
again,
I
said
we're
gonna
make
things
harder
just
for
fun,
but
yeah,
and
this
is
obviously
a
very
small
line.
Anyway,
we
don't
care
all
right.
A
A
You
know,
let's
see
what
happens
if
we
actually
pass
it,
something
that
makes
no
sense
right.
This
user
id
doesn't
exist
in
the
database
and
we're
going
to
try
to
say,
hey,
prisma,
create
me
a
post
with
this
user
and
prism
is
going
to
say
what
there's
an
error
on
that
and
let's
go
look
at
the
console
and
see
what
that
looks.
Like
the
error,
looks
like
this
user
facing
error.
A
What
does
it
look
like?
I
don't
know
what
it.
C
A
Like
but
that
that's
a
bad
error,
actually
we
should
probably
talk
about
that,
but
it's
a
better,
but
the
truth
is
it
aired
out
because
it
essentially
couldn't
find
the
user
all
right.
That
user
doesn't
exist.
So
there's
probably
a
better
way
to
do
this.
That
I
haven't
found
that
yet
because
I
haven't
cared
enough,
but
let's
go
ahead
and
pass
it-
the
real
user
id
that
we
want
to
do
here.
A
All
right,
so
that's
a
real
user
id
and
that
works
awesome.
Now,
let's
go
back
and
query
for
all
the
posts
that
we
have
in
the
database
and
we
have
that
post
awesome.
Now.
Here's
something
nifty
that
I've.
This
is
for
me
that
I
found
nifty.
So
in
a
lot
of
cases,
I
found
that
shaping
user
data
is
one
of
the
most
interesting
problems
in
applications
as
you
get
bigger,
so
I'll
give
the
quickest
example,
I
can
think
of
you
have
a
list
of
users
in
your
application
and
you
want
a
query.
A
You
want
a
query
that
says
give
me
you
know,
give
me
users,
paginate
them,
etc.
Do
all
these
things
right
now,
when
you
want
to
get
users
for
a
list,
the
users
don't
really
need
to
include
everything
right.
So,
for
example,
a
user
could
have
posts,
it
could
have
likes,
it
could
have
photos,
it
could
have
files.
It
could
have
the
workspace
that
it
belongs
to
like
a
bazillion
different
things
right
and
you
don't
need
all
those
things.
A
So
then,
inevitably,
you
end
up
creating
these
shapers
all
over
the
application
that
say:
okay,
this
is
the
specific
shape
I
want.
When
I
pull
a
list.
This
is
a
specific
shape.
I
want
when
I
pull
the
user
details
like
all
these
different
things
right.
A
So
in
the
user's
controller,
we
have
the
get
users
endpoint,
which
we
already
went
through
right
and
it
gives
us
an
array
of
users
and
those
users.
Don't
include
anything,
however,
if
I
want
to
get
user
by
id.
Let's
assume
that
here,
I'm
going
to
just
like
display
the
user's
details
and
all
of
their
things
now
what
I
can
do
is
I
can
do
I
can
use
this
thing
called
an
include
statement
which
prisma
provides
when
you're
running
a
query,
and
here
in
the
include
we
don't
have
likes.
Yet,
let's
not
talk
about
that.
A
I
can
just
say
post
true,
so
any
posts
that
that
user
has
created
that
are
related
to
that
user
are
going
to
be
included
in
that
shape
and
now
again
using
your
imagination,
you
could
imagine
how,
in
a
request,
you
could
potentially
create
query
parameters
that
determine
what
is
included
in
the
shape,
so
this
could
be
created.
This
could
be
controlled
completely
by
the
back
end.
A
Saying:
okay,
the
backend
has
these
specific
shapes
that
we're
going
to
send
you
in
different
points,
and
you
know
you
have
to
figure
that
you
have
to
make
the
right
query
the
right
input.
You
have
to
hit
the
right
endpoint
or
you
can
just
say,
hey
we're
going
to
give
you
a
bunch
of
query
parameter
parameters
and
you
can
just
go
ahead
and
go
nuts
and
say:
okay
include
posts,
don't
include
posts
include
likes,
include,
workspace,
etc
and
then
run
a
bunch
of
you
know
just
conditionals
here.
A
So,
for
example,
if
query
posts,
let's
say
that
posts
is
the
parameter
right
and
now
you
can
just
do
that.
So
essentially,
if
you
could
imagine
actually
it
would
be
something
like
wreck
query.
So
if
my
request,
my
query,
includes
posts
as
a
boolean
to
true
then
include
post
and
then
so
on
and
so
forth
for
everything
that
belongs
to
that
user.
So
that's
a
very
dynamic
endpoint
that
you're
creating
for
your
consumers.
In
most
cases,
the
consumers
yourself
so
you're
making
life.
A
A
Here
we
go
user
by
id,
so
this
is
users
we're
going
to
pass
it
an
id,
and
it's
going
to
do
that
so
now
we
have
not
only
the
user
details
but
also
an
array
of
all
of
their
posts,
because
I
did
that
include
posts
pretty
cool
and
again
this
is
just
very
basic
crud
operations,
but
I
think
for
me
it's
about
like
a
lot
of
the
scalability
and
the
dynamism
of
when
you
have
an
application,
how
your
data
comes
back
and
really
what
this
does
is
it
kind
of
gives
you
a
very
consistent,
yet
dynamic
shape
so,
like
you
know
that
posts
always
come
back
this
way,
but
you
don't
necessarily
have
to
include
them
everywhere.
A
You
know
the
user
always
comes
back
this
way,
but
you
don't
necessarily
need
to
include
all
the
users
anywhere
when
you,
for
example,
fetch
a
post
so
same
deal.
So
here
we
fetched
posts
right
and
it's
just
an
array
of
posts.
So
if
we
wanted
to,
we
could
just
actually
fetch
post
by
id.
A
I
don't
know
if
I
have
that
query
somewhere.
Maybe
I
do
maybe
I
don't,
but
we
can
just
create
it
really
easily
by
saying
by
doing
this,
so
fetch
a
post
by
id
and
we
can
have
it
include
the
user.
So
right
now
you
can
see
it's
not
including
the
user.
Let's
go
ahead
and
do
that
post,
oh
no
post
controller
and
when
we
fetch
a
post
by
id,
we're
just
going
to
say,
hey
include,
and
these
are
all
the
things
I
can
include.
A
A
Oh
something
errored
out
and
I
didn't
notice
it
or
it
wasn't
running.
I
guess
it
wasn't
done
compiling
all
right.
There
we
go
now.
Our
post
comes
back
with
the
user,
that's
cool
yeah!
Maybe
it's
not
so
cool,
it's
just
a
get
request,
but
I
think
it's
cool
all
right,
so
cool.
So
I
was
going
to
go
through
and
add
likes
to
these
posts,
and
my
thought
process
is
a
like.
A
Essentially
I
like
has
a
user
id
and
which
is
the
user
liking,
something
and
it
has
a
post
id
which
is
the
post
being
liked.
Now
I
don't
know
if
we
have
time
now
that
I'm
looking
at
the
clock,
so
I
just
want
to
kind
of
call
out
tom
tom.
What
do
you
think?
How
are
we
doing.
A
Okay,
so
I
think
it's
probably
best
to
skip
that
portion.
You
guys
can
imagine
what
that
looks
like,
because
it
looks
very
similar
to
what
we've
been
doing
so
far,
really
yeah.
It's
it's
very
it's
very
much
of
very
much
the
same.
So
this
is,
I
just
want
to
say.
This
is
mostly
just
scratching
the
surface
right.
This
is
this
is
the
most
basic
things
that
you
can
do
with
this
with
this
tool.
A
There
are
so
many
more
things
that
you
can
do
just
just
as
a
as
a
quick
example,
I
can
actually
show
schema
from
a
kind
of
a
hobby
project
that
I've
been
working
on
so
yeah.
You
guys
can
see
something
a
little
bit
more
substantial,
I'm
just
going
to
show
the
schema,
because
otherwise
it
takes
too
long
to
kind
of
go
through
everything.
A
All
right,
so
this
is
schema
for
a
project
that
I'm
working
on,
and
the
thing
that
I
want
to
call
out
is:
is
relations
right
so
like
every
single
one
of
these
models
has
a
crazy,
well,
not
crazy,
but
some
of
them
do
have
a
crazy
amount
of
relations
and
once
you're
like
querying
data
in
your
application,
it's
just
so
very
easy
to
connect
things
to
include
things
to
select
attributes.
A
I
didn't
show
select,
but
you
guys
get
the
idea,
and
once
this
grows
using
the
client
like
having
a
client
that
has
all
of
those
things
type
in
a
type
safe
way
with
attributes
for
creating
attributes
for
fetching
for
including
it
just
becomes
incredibly
incredibly
valuable.
So
again,
this
is
like,
for
example,
an
organization
model,
and
the
organization
can
have
a
creator
and
can
have
clients.
You
can
have
an
invitation.
So
at
any
point
I
can
just
decide
to
include
any
of
these
things
in
my
organization.
A
Shape
and
it'll
fetch
them
easy
peasy
right,
no,
no
fussing
about-
and
this
is
interesting
because
this
this
project,
for
example,
we
made
a
very
clear
choice,
not
saying
it's
the
right
choice
or
what
have
you,
but
we
made
a
choice
to
say
every
every
resource
has
to
have
a
created
by
and
if
you
that,
basically
results
in
this
user
model,
basically
having
all
of
these
created
resources
that
you
can
fetch
for
them.
A
If
you
chose
to
right
so
like
which
projects
have
you
created,
which
which
organizations
have
you
created,
et
cetera,
et
cetera,
et
cetera,
and
as
we
create
more
stuff,
this,
this
user
model
keeps
writing,
which
I
thought
was
pretty
funny,
but
again
just
kind
of
gives
you
an
idea
for
how
how
much
how
complex
things
can
get
and
how
something
like
this
can
help.
You
manage
that.
C
D
I
do
not,
but
I
just
want
to
say
I
really
appreciated
this.
It
was
awesome.
I
thought
it
was
super
cool.
I
do
have
to
get
going,
but
thanks
once
so
much
thanks
tom
for
hosting
this.
C
Guys
well,
thank
you
guys
for
joining,
as
as
as
I
noted
earlier,
I
will
record
this
and
post
it
on
charlestonjs.com,
so
you
can
watch
it
again
or
share
it
with
some
friends
and
we'll
be
back
next
thursday,
with.
I
believe,
tyler
hall's
going
to
give
a
talk-
and
I
can't
remember
the
subject
but
but
it
should
be
a
good
one
concerning
react.
C
I
think
so,
thanks
for
joining
in
thanks
juan
for
the
presentation,
it
was
awesome,
prisma
looks
like
an
awesome
orm
and
they
can
get
a
lot
of
use
out
of
it.
So
with
that
see
everybody
next
week
and
thanks
for
joining.