gpt4 book ai didi

node.js - 如何将 polymer cli v-2.0 与 node js 和 express 一起用于制作应用程序?

转载 作者:搜寻专家 更新时间:2023-11-01 00:16:47 26 4
gpt4 key购买 nike

我已经安装了 polymer-cli 并设置了一个 Express 服务器。如何使用 Express 运行 Polymer 代码?

最佳答案

Routing with Polymer and Express - 此链接可让您使用 Express 运行 Polymer 代码并设置 Express

// Node.js notation for importing packages
var express = require('express');

// Spin up a server
var app = express();

// Serve static files from the main build directory
app.use(express.static(__dirname + '/build/bundled'));

// Render index.html on the main page, specify the root
app.get('/', function(req, res){
res.sendFile("index.html", {root: '.'});
});

// Tell the app to listen for requests on port 3000
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});

关于node.js - 如何将 polymer cli v-2.0 与 node js 和 express 一起用于制作应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44469454/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com