作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我已经安装了 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/
我是一名优秀的程序员,十分优秀!