Angular 2 RC使用Express服务器而不是Lite服务器 [英] Angular 2 RC with express server instead of lite server

查看:91
本文介绍了Angular 2 RC使用Express服务器而不是Lite服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用最新的angular 2 rc和express服务器创建单页应用程序。我不知道如何将bower,gulp和webpack都链接起来。
有一些入门包可用,但无法获得预期的。请指导我

I would like to create single page application with latest angular 2 rc and express server.I don't know how to link both with out bower,gulp and webpack. There are some starter pack available but can't get the expected one.Please guide me

推荐答案

问题是确实很广泛,但这是一个与express和rc.1的github入门项目链接:与express的Angular 2入门项目/ a>

The question is really broad but here's a github starter projects link with express and rc.1: Angular 2 starter project with express

服务器从 app.use(express.static(__ dirname +'/ client'))识别index.html; 行。这意味着在客户端目录下查找名为 index.html 的文件。

The server identifies index.html from app.use( express.static(__dirname + '/client' ) ); line. This means look for a file that is named index.html under client directory.

您可以将后端的附加路由添加到 routes.js 中。对于客户端,就像浏览页面和其他内容一样,我建议您看一下angular2的路由教程/文档: http://angular.io/docs/ts/latest/tutorial/toh-pt5.html

You can add aditional routes for backend to routes.js. For client side, like navigating through the pages and stuff I suggest you to take a look at angular2's routing tutorial/documentation: http://angular.io/docs/ts/latest/tutorial/toh-pt5.html

这篇关于Angular 2 RC使用Express服务器而不是Lite服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆