nazreen
nazreen

Reputation: 2078

is hapi's server.inject production safe?

I have encountered server.inject in test examples, but not in production code example.

I have a route that needs to execute something that is handled by another route, so I need to make an internal call.

handler: (req, res) => {

const OPTIONS = {
method: 'POST',
path: '/path'
payload: {PAYLOAD_HERE}
}

server.inject(OPTIONS, (err, response) => {
    res(response)
});

}

is this okay?

Upvotes: 0

Views: 439

Answers (1)

Gangstead
Gangstead

Reputation: 4182

Yes. I've done exactly that in a large scale production system.

Upvotes: 1

Related Questions