简体   繁体   中英

Is there a way to send data between a firefox extension and a node.js program?

My goal here is to make a discord rich presence program using node.js. I want to make a firefox extension to send the data to a node.js program. I have found people trying to do a similar thing ( here ), but I havent found anyone trying to do the same thing as me. I'm not very good at plain JavaScript, only node.js thanks to its libraries, and I wanted to know what code I'd need for the node.js application, as well as the firefox extension. I have searched quite a bit, but to no avail.

I finally figured out how to pull this off, and I want to share my findings with everyone. You need to install json-server from npm, create a json file and then launch it using:

json-server --watch lib.json --port 0420

After that, you can make the extension do PUT requests to set data, and then you can get the program to read the new data, set discord to watch the local programs title, and then use that!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM