pekko/akka-docs/rst/scala/http/routing-dsl/directives/file-and-resource-directives/getFromResource.rst
2016-01-14 00:31:03 +01:00

26 lines
No EOL
768 B
ReStructuredText

.. _-getFromResource-:
getFromResource
===============
Signature
---------
.. includecode2:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/FileAndResourceDirectives.scala
:snippet: getFromResource
Description
-----------
Completes GET requests with the content of the given classpath resource.
For details refer to :ref:`-getFromFile-` which works the same way but obtaining the file from the filesystem
instead of the applications classpath.
Note that it's not required to wrap this directive with ``get`` as this directive will only respond to ``GET`` requests.
Example
-------
.. includecode2:: ../../../../code/docs/http/scaladsl/server/directives/FileAndResourceDirectivesExamplesSpec.scala
:snippet: getFromResource-examples