Reactjs 将CRA部署到s3并与express一起使用
我想将CRA捆绑包部署到s3并从cloudfront提供服务。但索引文件应该是expressview(模板,我想向其中添加一些数据)。我找到的所有解决方案都假定无服务器或直接从节点提供CRA索引Reactjs 将CRA部署到s3并与express一起使用,reactjs,express,amazon-cloudfront,devops,create-react-app,Reactjs,Express,Amazon Cloudfront,Devops,Create React App,我想将CRA捆绑包部署到s3并从cloudfront提供服务。但索引文件应该是expressview(模板,我想向其中添加一些数据)。我找到的所有解决方案都假定无服务器或直接从节点提供CRA索引 所以,我需要将索引作为模板,并包含指向捆绑包的cloudfront URL。如何实现这一点?如果需要创建并索引.html,则无需使用模板即可实现 app.get('/', function(req, res) { res.type('text/html'); res.send('<html
所以,我需要将索引作为模板,并包含指向捆绑包的cloudfront URL。如何实现这一点?如果需要创建并索引.html,则无需使用模板即可实现
app.get('/', function(req, res) {
res.type('text/html');
res.send('<html>...</html>');
});
资料来源:
帕格
doctype html
html
head
title Jade Page
link(href='https://cloudf../css/main.css', rel='stylesheet')
body
h1 This page is produced by Jade engine
p some paragraph here..
html
head
title= title
link(href='https://cloudf../css/main.css' rel='stylesheet')
body
h1= message
app.get('/', function (req, res) {
res.render('index', { title: 'Hey', message: 'Hello there!'});
});