When I run my hapijs app locally it is working but when I deploy it in the server it doesn't work. The page can serve html files but if the HTML file has css or bootsrap then it prints weird symbols like ��U�v�8��+
The link that shows the weird response : https://us-central1-fir-app-85853.cloudfunctions.net/v1/teacher/list
Here is my index.js file.
How can I fix this issue?
'use strict';
const functions = require('firebase-functions');
const api = require('./server');
exports.v1 = functions.https.onRequest(async (event, resp) => {
let server = await api.startServer();
const options = {
method: event.httpMethod,
headers: event.headers,
url: event.path,
payload: event.body
};
return server
.inject(options)
.then(response => {
delete response.headers['content-encoding']
delete response.headers['transfer-encoding']
response.headers['x-powered-by'] = 'hapijs'
resp.set(response.headers);
return resp.status(response.statusCode).send(response.result);
})
.catch(error => resp.status(500).send(error.message || "unknown error"));
});
Here is my full source code on github https://github.com/kartikgreen/hapijs-firebase