How to renderTextLayer of pdfjs in nodejs for SSR? - node.js

I have tried the pdfjs in browser javascript and it is working fine but if i try to render the textLayer in server side with nodejs it is throw error for canvas.
Anyone know how to make this happen in server side with nodejs?
I asked the same in offical github repo, and they replied it is possible with jsdom. but don't know how to do that
https://github.com/mozilla/pdf.js/issues/11011

Related

Connecting front-end and back-end with react and mongo DB - 404 error

I am trying to connect an app hosted in my localhost:3000 port. The back-end is on the localhost:8080 port (not a remote API but on my own PC. I downloaded a pre-created back-end api and linked the front-end to the back-end with MongoDB using an .env file.
The weird thing is that on MongoDB the connection looks ok, following the tutorial I am using. The backend and the front-end also look alrigh, however, I am unable to login with the form in the screenshot.The error I get when trying to login or create a new user is "xhr.js:178 POST http://localhost:3000/login 404 (Not Found)"
It was a bit hard to put the whole code here, so I am linking you to the front-end repo: https://github.com/manuelalonge/complex-app and the back-end repo: https://github.com/manuelalonge/back-end-api
I can understand the issue is most likely on the back-end but I could not understand where exactly. I tried to get back to the previous lessons in the tutorial but it still doesn't get solved.
Probably it is easier to solve this issue with a screenshare session, so if anybody would contact me I'll be grateful.
Screenshot --> [1]: https://i.stack.imgur.com/jVJzn.png
Your screenshot points to what's wrong. You're posting to localhost:3000, as you know this is the frontend webpack server.
You'll want to create an axios config file and set a base url to hit the correct endpoint.
const axiosInstance = axios.create({
baseURL: 'localhost:8080'
});
export default axiosInstance;
Also, please add some sort of file structure.

How can I use handlebars in Google Cloud Functions?

I have a node.js + espress + handlebars app that works fine on localhost. However, when I deploy it to Google Cloud Functions, my public directory, containing client-side javascript, css and jpg's etc., does not seem to be found or accessible.
When (in Chrome DevTools) I try to inspect the client code .js that is referenced in my handlebars main template, I get a message Your client does not have permission to get URL /ClientCode.js from this server.
What do I do wrong; anyone any ideas how to solve this?

How to sync react native app with express app?

I am using react native android app for recording calls.Once the call get recorded, it should be uploaded to serer(express js and mysql) with call details.Suppose the app is in offline the file should uploaded to server whenever the app comes to online.How should i acheive this.
NOTE: All the above mentioned process should be run in background.
I found some solutions like pouchdb. For react native (pouchdb-react-native) npm and for express js (express-pouchdb) using this npm can i achive the sync? and how?
It is possible - using PouchDb server and LevelUp - to sync PouchDb with different backend databases. See this answer for details and the Nolan Lawson article on LevelUp.

node.js + express + socket.io + codeigniter

I am unable to establish the connection between codeigniter and node.js using socket.io. I tried lots of things but I can't figure out a way to do this since I am somewhat new to node.js and totally new to socket.io.
Basically what want to do is update my codeigniter view using node.js in real time. so I use socket.io.
Here is how things looks like.
Folder structure
htdocs/myproject //codeigniter application
>application
--controller
***abcCon.php
--view
***abc.php
>flight //node application with express
--bin
***www
--routes
***index.js
---app.js
In here :
codeigniter app seperatly works fine. localhost/mydomain/flight_status/arrival_status gives the expected view.
Node.js app seperatly works fine.
localhost:3000/arrival_status gives the expected json.
So how do I connect these two using socket.io? I went through lots of tutorials and non of them teach how to make through express installation.

Browserify the node.js http server

We created a simple js file, intending to find out if http.createServer works on client browser or not:
var http = require("http")
var server = http.createServer()
server.listen(9024, function () {
console.log("demo server listening on port 9024")
})
and embedded it into a html after browserify.
Display the html in chrome, unfortunately, it always fails on line 2 on http.createServer():
"Uncaught Type Error: undefined is not a function"
We also played around with "serve-browserify" a bit without success.
We have attempted the same thing on both chrome and firefox, and on Linux and Windows. All failed.
Searching through the web, there are quite a few examples for browserify http into the browser.
They all appear to be simple invocation of browserify. However we don't seem to be able to get the same good result.
Your help will be greately appreciated.
You can't use Node.js modules in the browser. All Browserify does is bundling CommonJS modules, it does not allow you to run server side code in the browser.

Resources