angular.js - angular静态网页 怎么部署到node上面
大家讲道理
大家讲道理 2017-05-15 16:55:19
0
5
554

我有一个可以在Apache上跑的静态angular项目,想在想把它迁移到node环境里去,不知道该怎么写node的server.js和page.json.

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(5)
阿神

Just write it like this in KOA

var koa = require('koa');
var serve = require('koa-static');
var path = require('path');

// KOA框架
var app = module.exports = koa();

// 错误处理
app.on('error', function(err, ctx){
    console.log(err.message);
});

// 静态中间件
app.use(serve(path.join(__dirname, 'public')));

// 监听端口
if (!module.parent){
    app.listen(3000);
    logger.info('My Website run on 3000...');
}

/app.js
/public/index.html //angular entrance

世界只因有你

Use nokit, one line of command:

$ cd <angular项目目录>
$ nokit start <port> -public:./

For more detailed usage, check http://nokit.org

習慣沉默

Put it directly in the static file. After use, just access the static page address directly. This is how this game works
http://tianmaying.com/app/collect-b/index.html

为情所困

express

为情所困

Hey, try sero-cli. The second item is "Start a static web server for current working directory". Use this command in the root directory of your angular project. Just select the second item.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template