Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can I add a route to serve static files? #15

Open
gino8080 opened this issue Feb 2, 2018 · 0 comments
Open

how can I add a route to serve static files? #15

gino8080 opened this issue Feb 2, 2018 · 0 comments

Comments

@gino8080
Copy link

gino8080 commented Feb 2, 2018

Hello, thank you for the great example!

I'm trying to add a route to serve static files using inert,
but I'm not able to use the "h" method like in the inert examples:

I tried adding a route like this:

server.route({
        method: 'GET',
        path: '/staticpath', //or public..
        config: {
            handler: function(request, h){
              //here i can't get the h, just the reply
               return h.file("public/index.html");
            },
            tags: ['api', 'virtual'],
            description: 'Virtual Get user info'
            }

        }
    });

I keep getting the error
Property 'file' does not exist on type 'ReplyWithContinue'.

I found this on type definition

  • NOTE: it's not possible to type the result of this action.
    • It's advised that in a custom definition file, you extend the ReplyNoContinue
    • and ReplyWithContinue functions. See Inert .file for an example.
    • Or if it is not part of a library / plugin then you use a namespace within
    • your code to type the request, server and or reply. See
    • [tests/server/decorate.ts]

But I don't know how to extend the ReplyWithContinue definitions
hope I explained my problem,
and sorry for my english !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant