Home

hapiinert

Hapiinert, commonly referred to as Inert, is a plugin for the hapi.js web framework that provides static file and directory handling. It enables a hapi server to serve static assets from the filesystem and to expose directory listings when no index file is present. The plugin is designed to integrate with hapi’s routing system and is often used to serve assets such as HTML, CSS, JavaScript, images, and other files.

Installation and usage are straightforward. In modern releases, the plugin is published under the package name

Key configuration options include the root filesystem path, whether to serve an index file when a directory

Compatibility and security considerations are important. Inert is focused on static content delivery and does not

@hapi/inert
and
can
be
installed
via
npm.
After
installation,
the
plugin
is
registered
with
the
hapi
server,
for
example
by
calling
server.register(require('@hapi/inert')).
Once
registered,
routes
can
be
configured
to
use
a
directory
handler
to
serve
files.
A
typical
route
would
specify
a
path
pattern
like
'/{param*}'
and
a
handler
that
declares
directory
options,
such
as
path:
'public',
index:
true,
listing:
true.
is
requested,
and
whether
to
allow
directory
listings.
The
directory
option
provides
the
primary
means
of
delivering
static
content
and
exposing
directory
contents,
while
other
dynamic
content
should
be
handled
by
separate
route
handlers.
perform
server-side
processing
of
dynamic
content.
Administrators
should
restrict
the
served
directory
and
be
aware
that
enabling
directory
listings
can
reveal
internal
files,
so
access
control
and
proper
permissions
are
recommended.
The
plugin
is
maintained
by
the
hapijs
community
and
is
available
for
current
hapi.js
releases,
including
modern
@hapi
versions.