Skip to main content
0 votes
0 answers
33 views

How do I make cors policy on hapi.js working?

I have this hapi.js restful api server demo that tried to be accessed by external domain but failed. here is the Hapi instance: const init = async () => { const server = Hapi.server({ port: ...
Aldi Fayol's user avatar
1 vote
1 answer
40 views

Joi conditional validation

I have an object which looks like this: const preference = { INVENTORY: { id: true, part_name: true, part_number: true, is_available: false }, ASSET: { name: true, type: ...
SunAns's user avatar
  • 323
-2 votes
1 answer
65 views

Current User Implementation in Javascript

I'm trying to keep in track of current user of an request across my javascript code base and some data along with it within that request scope I tried to pass the current user from controller(read ...
Arjunasarathy M's user avatar
0 votes
0 answers
23 views

Which directories remain private whilst running a Vue.js application on Hapi?

I've been using Hapi.js to run my API server for a few years and I have been very pleased with simplicity and peformance. In order to reduce complexity I am considering moving my Vue.js application ...
Not a machine's user avatar
0 votes
1 answer
61 views

How to enable CORS in Hapi (post version 17)

In pre-v18 of Hapi, enabling CORS was pretty straightforward: const server = Hapi.server({ port: 3000, host: 'localhost', routes: { cors: true } }); With v18 the syntax for ...
Not a machine's user avatar
1 vote
2 answers
760 views

Cannot find module error while mocking elements in Jest unit testing with TypeScript in Node.js

I'm currently working on integrating Jest unit testing into my Node.js application that's written in TypeScript. However, I'm encountering an error when trying to mock certain elements. Here's the ...
Athulya Ratheesh's user avatar
0 votes
1 answer
112 views

Vercel wildcard route's src results in 404 error in Hapi.js backend

I'm currently trying to deploy a TypeScript Hapi.js server to Vercel and facing difficulties with the deployment. I've tried following some express with TypeScript deployment tutorials, since I couldn'...
VallenDra's user avatar
0 votes
1 answer
89 views

Cannot implement JWT authorization in `hapi.js`

I am interested in incorporating the JWT strategy into the backend of my Hapi.js application to enhance security measures and improve authentication processes. here is my server code : const Hapi = ...
Abubakr Shomirsaidov's user avatar
0 votes
1 answer
179 views

Can we make a Joi object optional but the fields nested inside required if the object is invoked?

export const OrganizationUpdateSchema = Joi.object({ uid: Joi.string().trim().required(), organizationDetails: Joi.object({ email: Joi.string().email().trim(), ...
Worldwide's user avatar
0 votes
1 answer
149 views

Need help in migrating Hapi application to v20.0.1 from v16.4.3

`I need to migrate a hapi.js application from v16.4.3 to ^20.0.1. Since there are major changes made in v17.0.0 including reply() interface upgradation. Is there any optimal way to replace return ...
Ankur Kumar's user avatar
0 votes
1 answer
396 views

Error on implementing cache system with @hapi 21.3.2

I've been asked to upgrade our hapi server from version 11 to the latest version (21.3.2), which requires quite a bit of refactoring. I've managed to get the server running, and everything seems to be ...
Sylvain Jacot's user avatar
0 votes
0 answers
200 views

Joi validation not working for alternatives conditional schema with switch option

I have the following Joi schema validation code: const Joi = require('joi'); const baseTaskSchema = Joi.object({ id: Joi.number().integer().required(), retailer_id: Joi.string().required(), ...
AnandShiva's user avatar
  • 1,429
0 votes
1 answer
570 views

Validate uploaded file size in Hapi.js

Using Joi for validation in API, is there a way we can validate and allow file size to api upto max limit.? payload: { maxBytes: 20715200, output: 'stream', parse: true, allow: ...
Animesh jain's user avatar
0 votes
1 answer
116 views

How can i control encoding on hapijs cookies?

I'm trying to get an auth system using hapijs + secure cookies. in my auth handler I'm setting 2 cookies: h.state("idToken", JWT.token, optionsObject); h.state("refreshToken&...
TadeoArmenta's user avatar
1 vote
0 answers
98 views

Passing data from hapi server to NEXT page

I have an application using NEXTJS with Hapi as backend server. The application is having below format. // Hapi server handling server.route({ method: ['GET'], path: '/hello-world', ...
niyasc's user avatar
  • 4,508

15 30 50 per page
1
2 3 4 5
91