►
From YouTube: Life API: Personal Tracking with JavaScript - Jane Kim
Description
Life API: Personal Tracking with JavaScript - Jane Kim
A
So
this
is
a
pretty
basic
talk,
we're
gonna!
You
know,
I'm
gonna
go
into
a
little
bit
of
a
personal
project
of
mine,
but
you
know,
depending
on
what
skill
level
you're
at
this
might
be
a
little
easier,
a
little
harder
but
we'll
see
we'll
just
roll
with
it.
So
my
name
is
jane,
I'm
from
new
york
city
and
that's
my
handle
pretty
much
everywhere,
and
so
I've
come
into
this
problem
of
being
an
adult
is
really
hard.
A
A
Like
you
know,
you
know
I
was
taking
a
new
medication
and
my
doctor
was
like
you
have
to
keep
track
of
like
when
you
take
your
medication,
how
it
makes
you
feel
and
all
that
stuff-
and
I
was
like
you
know-
I
wish
I
didn't-
have
to
do
that-
my
own,
and
so
it's
you
know
and
also
having
to
take
that
medication
every
day
at
the
same
time.
So
I
don't
know
if
you've
ever
had
this
kind
of
problem.
A
Where
you
aren't
consistent,
you
know
your
life
is
really
busy,
so
you
don't
have
time
to
like
worry
about
these
things,
but
you
know
it's
important
to
remember
that
good
habits
are
always
built
with
incremental
wins.
What
does
that
mean?
I
mean
that
you
know.
If
I
have
a
goal,
you
know
keep
the
goals,
keep
the
tasks
that
I
have
to
do
for
that
goal
as
small
as
possible.
A
So
medication
is
one
example
where
you
kind
of
have
to
be
consistent,
do
something
once
a
day
and
so
there's
but
there's
so
many
other
things
that
you
kind
of
want
to
build
good
habits
about
right,
maybe
you're
trying
to
avoid
certain
foods
or
something
that
make
you
feel
sick,
or
maybe
you
already
you
drink
too
much
and
you
kind
of
need
to
tone
it
down.
And
how
do
you
deal
with
that?
So
this
I
kind
of
got
this
idea.
A
So,
for
example,
another
goal
is
to
just
become
a
better
photographer.
How
do
you
do
that?
You
might
take
one
picture
every
single
day,
so
you
have
this
small
little
thing
that
you
can
do.
That
will
basically
go
towards
your
big
goal.
Maybe
you
want
to
commit
something
every
single
day
to
github.
I
don't
think
I
know
anyone
who
has
this
kind
of
streak.
It
looks
kind
of
like
impossible.
I
don't
know
if
you
have
something
like
that.
A
If
you
do,
we
can
talk
so
there's
this
idea
of
these
goals
and
being
able
to
kind
of
break
them
down
into
incremental
incremental
little
tasks,
and
so
that
is
basically
going
to
set
you
up
for
sex
success
for
the
long
term
and
really
just
help
you
make
gains
in
your
life.
So
now
we're
talking
about
tracking
something
every
day.
So
in
my
mind,
the
way
to
do
this
is
to
be
able
to
track
something
on
a
daily
basis
or
over
a
period
of
time.
So
you
can
wear
fitness
trackers
and
you
can.
A
You
know
apple,
watches
and
things
like
that,
but
not
everyone
has
does
one
doesn't
want
to
wear
one
on
their
wrist.
Two,
like
you
know
they
don't
hot.
A
They
don't
actually
offer
you
all
the
like
apis
and
data
that
you
kind
of
want
to
have
access
to,
and
so,
if
you
want
to
track
a
bunch
of
personal
data,
so
say
you
know
if
I
wanted
to
track
like
when
I
take
the
medication
every
day
and
then
maybe
like
you
know,
if
I
feel
kind
of
moody
that
day
like
if
I
get
angry
about
something,
oh
I'll
track
that
or
if
you
know
I
have
like
an
injury
and
I'm
trying
to
keep
track
of
the
pain
level.
Something
like
that.
A
So
there's
a
lot
of
personal
data
that
you
can
gather
just
from
like
you
know,
keeping
a
log
of
anything
like.
Maybe
you
want
to
keep
a
log
of
how
consistent
you've
been
committing
to
github,
so
you
have
that
street
chart.
But
what,
if
you
just
wanted
to
quantify
that
yourself,
and
so
with
any
fitness
tracker,
an
apple
watch
like
the
health
app
or
any
kind
of
health
kit
type
thing.
That's
offered
you
can't
you
don't
own
that
data.
A
It's
not
yours
to
keep
right
and
you
don't
know
necessarily
how
to
interact
with
that
api.
If
there's
one
offered,
so
I
kind
of
thought
of
an
idea
of
why
don't
I
try
to
code
out
on
myself.
A
So
then
I
thought
of
this
idea
of
a
personal
api
where
you
have
your
own
data,
you
own
your
own
data,
you
store
it.
However,
you
want,
and
then
you
basically
create
an
api
to
expose
whatever
kind
of
data
and
which
you
know
any
filters
or
queries
that
you
want
to
put
on
top
of
those.
A
So
that's
how
I
came
up
with
this
idea
for
life
api,
which
is
like
diy
personal
tracking
with
code
and,
of
course,
it's
all
written
in
javascript,
because
we're
here
at
node,
interactive
and
so
let's
write
a
personal
api.
Then,
but
first
you
know:
let's
do
a
refresher,
we're
not
talking
about
just
any
apis,
we're
talking
about
restful
apis
and
if
you
don't
remember,
restful
api
stands
for
representational
state
transfer.
A
But
what
that
really
means
it's
a
resource-based
service
and
it's
a
you
know
our
common
architecture
that
is
pretty
prevalent
on
the
web
today
and
it's
not
going
anywhere
anytime
soon.
I
know
there's
things
like
other
api
type.
Things
like
graphql
popping
up,
but
you
know
rest
apis
are
still
kind
of
the
standard
and
a
rest.
Api
is
a
rest
api
because
of
these
constraints.
A
So
a
uniform
interface,
which
basically
means
kind
of
like
consistency,
stateless,
so
you
don't
store
any
kind
of
state
on
the
server
side
and
you
kind
of
maintain
that,
on
the
you
know,
if
you
have
a
client-side
application,
you
maintain
state
there
and
all
you're
doing
is
asking
for
resources
from
the
service.
It's
cachable,
so
you
know
you
can
be
able
to.
You
know
paying
the
same
service
and
get
faster
results
based
on
like
if
you
had
queried
that
already
once
before.
A
It
depends
on
the
idea
of
a
client
and
a
server.
So
you
have
a
client,
that's
using
a
rest
api
which
is
a
server
to
get
resources
and
then
a
layered
system,
which
kind
of
just
means
that
you
don't
have
to
rely
on
knowledge
about
the
server
to
ask
it
for
resources.
So
all
you
know
is
like
kind
of
the
structure
that
you
know
the
data
is
going
to
be
returned
as
and
what
you
want
to
get
out
of
it.
A
So
that's
all
the
client
knows
the
kind
of
separation
of
concerns
that
you
know
is
really
popular
in
web
development.
Server
takes
care
of
just
like
giving
you
the
data
that
you
need
and
making
sure
and,
like
all
the
hardware
level
implementations
things
like
that
about
like
network
connections,
what
kind
of
like,
if
you're,
using
nginx
or
something
like
that,
that's
all
kind
of
abstracted
away
for
the
person
utilizing
the
client
api.
A
So
these
are
basically
what
makes
a
restful
api.
If
you
don't
fulfill
every
single
one
of
these
requirements,
it's
not
a
restful
api.
It's
rest,
ish
api.
I
guess
you'd
call
that
so,
like
I
said,
rest
isn't
going
anyway,
anytime
soon.
So
it's
I
mean,
there's
a
whole
like
dissertation
about
how
rest
was
like
basically
created
super
interesting.
A
If
you
like,
basically,
google
restful
dissertation
you'll,
be
able
to
find
like
there's
a
whole
like
document
kind
of
going
into
technical,
abstract
detail
about
what
rest
is
so
so
common
things
that
you
have
to
keep
in
mind
when
you're
writing
a
restful
api
is
that
you
want
to
use
plurals.
A
So
in
the
example
that
I'm
about
to
show,
which
is
the
that
app
that
I
made
we
have
basically
logs
and
inputs
and
so
making
sure
it's
logs,
not
log,
because
you're,
basically,
you
know
querying
kind
of
a
database,
so
it
kind
of
keeps
with
that
idea,
and
you
don't
have
to
call
something
like
log
list.
You
know
you
just
call
it
logs
in
a
very
collections
oriented
type
of
way,
and
then
I
have
something
slash
inputs,
which
is
another
endpoint.
A
So
you
want
to
keep
your
segments
short
because
we're
we're
basically
representing
very
granular
resources
so
like
in
the
app
that
I
made,
we
have
inputs,
which
are
like
basically
just
a
time
log.
It's
just
like
has
an
object
with
a
time
stamp
and
like
maybe
a
log
associated
with
it,
so
keep
it
super
short.
I
mean
this
is
a
very
like
simple
example,
but
even
when
you
scale
up
to
large
applications,
you
will
kind
of
want
to
make
sure
that
you're
not
creating
insanely
long
uris,
because
that's
unreally
for
the
programmer.
A
It's
annoying
to
look
at
so
make
sure
to
keep
it
short
and
make
sure
to
remember
that
you
know
you
kind
of
want
to
keep
your
resources
as
like
atomic
as
possible.
So
this
does
that.
So
the
one
nice
thing
about
this
project
is
the
tools
that
I
use
kind
of
help
me
structured
the
api
in
a
way
that,
like
basically
the
front
end,
the
queries
in
the
front
end
mirror
the
back
end
structure.
So
the
first
line
is
just
the
regular
put
request
without
the
body.
A
You
know
you
used
to
have
a
body
with
a
put
request,
so
that's
log
slash
time
bet
time
and
then
the
second
line
is
a
pouchdb
which
is
a
catchdb
javascript
api,
and
so
I
just
take
logs
and
I
dot
put
the
log
which
log
contains
the
data
and
the
id
and
reference
that
it
needs
to
update
the
database.
So
that's
a
database
call.
It
looks
very
similar
to
the
uri,
that's
above
it
so
kind
of
mirroring
it.
A
Pouchdb
really
makes
this
easy
because
it
it
speaks
the
language
of
http
in
a
way
that
is
understandable
for
a
front-end
developer.
So,
as
I
mentioned,
these
are
tools
I
used.
I
use
happy.js
for
my
middleware
and
I
think
it
helps
me
set
up.
My
routes
really
nicely.
I
know
sometimes
in
express
it
can
get
a
bit
confusing
in
terms
of
like
flow
and
structure,
but
I
have
I'll
show
you
in
a
code
sample.
A
A
A
Oh,
I
see
so
I
have
couchdb
running
as
the
back
the
date
actual
database,
so
I
should
have
that
running
in
the
background
before
I
do
this.
Okay
great,
so
here
is
a
bunch
of
logs
that
might
not
make
any
sense
to
you.
Let
me
make
this
a
little
bigger,
so
I
gave
I
gave
a
couple
of
examples
before,
but
I
have
basically
a
bunch
of
different
inputs.
I
can
do,
and
all
I
have
to
do
is
press
a
button
to
create
an
input
into
that
log.
A
So
say
like
I'm
feeling
cranky,
I
can
just
click
drop
in
mood
and
it
will
record
a
new
data
point
like
this,
so
I
have
on
that
top
line
you
can
see.
This
is
just
basically
a
nice
debugging
interface
for
myself
to
be
able
to
look
at
my
data
in
a
raw-ish
format,
and
I
can
track
maybe
what
time
I
go
to
bed
every
night,
which
is
actually
super
useful
if
you're
trying
to
track
anything
like
if
I
go
to
bed
at
a
certain
time
does
it
affect?
A
You
know
how
I
feel
the
next
day
and
then
I
also
have
one
emoji
feels
which
is
basically
you
know
if
I'm
feeling
a
certain
way
right
now,
I'm
a
little
nervous.
No,
I'm!
Okay,
I'm
doing
all
right.
So
maybe
I'm
happy.
So
I
have
this
emoji
and
I
can
just
submit
that
and
it
creates
a
log
right
there,
and
so
I
have
like
a
an
input
type
called
text
emoji.
A
So
if
you
wanted
to
create
a
new
type
of
logs
so
say
if
I
want
to
keep
track
of
every
time
I
drink
water,
so
like
you're
supposed
to
drink.
Oh,
I
guess
I
don't
know
if
you
guys
use
cups
here,
but
like
eight
cups
of
water
a
day
which
is
hard
for
some
people,
I
think
it
sounds
like
a
lot.
A
So
if
I
wanted
to
say
drink
water
call
that
drink
water,
so
every
time
I
drink
a
sip
of
water,
I
just
click
on
that,
and
so
now
you're
looking
at
this
and
you
might
think.
Oh
so,
what's
the
big
deal,
we
have
a
bunch
of
data
so
going
to
just
like
a
simple
example.
Let
me
just
make
sure
that
data
is
fresh
all
right.
A
A
How
often
I
felt
like
stressed
out
or
like
you
know,
how
sleepy
I
felt
things
like
that,
so
you
can
just
make
it
nice
that
by
the
way
I
learned
d3
really
quickly
to
make
these
graphs
so
excuse
their
crudeness,
and
you
can
also
look
at
something
like
these
trends,
which
I
kind
of
alluded
to
before,
where
you're
keeping
track
of
say
something
like
morning,
meds
like
a
medication
that
you're
supposed
to
take
every
day
at
the
same
time
and
then
see,
if
anything
happens,
if
you
kind
of
take
it
too
late,
like,
for
example,
there's
this
blue
dot
over
here,
I
took
the
medication
like
way
later
in
the
day.
A
So
what
happened
after
that
kind
of
thing?
So
I
think
there's
more.
This
is
a
bit
contrived
data
because
I
didn't
actually
be
able
to
track
real
data,
but
this
is
kind
of
like
what
my
week
looks
like.
So
there's
that
and
then
here's
another
one.
If
you
you
know,
if
you
really
wanted
to
say
you
like
drink
a
lot-
and
you
don't
know
when
to
stop
so
you
can
build
something
out
that
helps
you
keep
track
of
how
many
drinks
you
had.
A
So,
if
I'm
drinking
throughout
the
night,
so
this
basically
in
a
six
or
seven
hour
period,
it
like
basically
keeps
track
of
how
many
drinks
I
had
and
if
I
have
too
many
drinks,
it
gets
all
red
and
kind
of
warns
you
that
you
should
probably
stop
drinking
and
get
too
drunk
but
yeah.
I'm
not.
I
swear
I'm
not
drinking
right
now.
This
is
just
an
illustration,
so
there's
that
these
are
all
the
different
things
you
can
do
with
this
kind
of
data.
But
this
is
super
simple.
A
I
think
the
way
that
you
know
creating
an
api
and
thinking
about
your
use
case
and
what
you
need
it
for
is
really
what
made
this
interesting
to
me
and
kind
of
applying
whatever
api
creation
knowledge
on
top
of
that,
and
you
can
play
around
with
different
kinds
of
inputs
if
you
wanted
to
get
a
little
more
granular
set
up
more
api
endpoints
and
the
way
I
have
is
set
up
in
so
I
basically
have
a
bunch
of
get
requests.
A
But
on
top
of
that
I
can
also
query
based
on
time,
so
just
adding
a
bunch
of
filters
on
top
of
the
original
get
request
to
get
more
data
say
I
wanted
to
only
look
at
one
week
of
my
life
or
if
I
wanted
to
look
over
a
couple
of
months.
So
that's
basically
it.
This
is
constantly
work
in
progress,
and
you
know
that's
the
nice
thing
about
it
is
that
it
kind
of
evolves
with
what
you
know.
A
You
know
I'm
actually
mostly
a
front-end
developer,
so
this
was
kind
of
a
way
for
me
to
start
working
in
the
back
end.
Try
to
think
about
how
to
create
an
api.
Like
what
that
actually
means
and
so
yeah,
so
this
is
always
a
work
in
progress
and
that's
it.
It
says
anyone
have
any
questions.