简体   繁体   English

这是否可以在服务器端使用带有 Node.JS 的前端 JS 框架来创建用于内容交付的 Web 服务?

[英]Is this possible to use a front-end JS Framework on the server side with Node.JS to create a Web service for content delivery?

I have a complete project made with Playcanvas (a JS GameEngine Framework) that uses the HTML canvas tag.我有一个使用 Playcanvas(一个 JS GameEngine 框架)制作的完整项目,它使用 HTML canvas 标签。 This project can also generate images in different format (base64, dataUrl, blob, jpeg).该项目还可以生成不同格式的图像(base64、dataUrl、blob、jpeg)。

I want to put this project on the server side to create a new Web service that can deliver images, generated from that Playcanvas project.我想将此项目放在服务器端,以创建一个新的 Web 服务,该服务可以交付从该 Playcanvas 项目生成的图像。

So, is this possible to use a functional code from the client-side and put it on the server-side with Node.JS?那么,这是否可以使用来自客户端的功能代码并将其与 Node.JS 一起放在服务器端? I know some works like node-canvas that achieve a similar goal.我知道一些像node-canvas这样的作品可以实现类似的目标。

在此处输入图像描述

You can use puppeteer(headless chrome) to get the full control of a browser on the server side.您可以使用 puppeteer(headless chrome) 来完全控制服务器端的浏览器。 You can then render the images on the server in required format and can export to the front end.然后,您可以在服务器上以所需的格式渲染图像,并可以导出到前端。

https://github.com/GoogleChrome/puppeteer https://github.com/GoogleChrome/puppeteer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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