云引擎快速入门
该文档帮助你快速的了解如何创建一个云引擎项目,本地开发调试,以及如何部署到云端。
创建项目
请根据《云引擎命令行工具使用指南》的《安装命令行工具》一节安装最新版的命令行工具,并确保你已经在本地机器上可以成功运行命令行工具:
tds help
如果一切正常,你应该看到命令行工具的帮助信息。
如果你尚未登录,请根据《云引擎命令行工具使用指南》的《登录》一节完成登录。
然后使用命令行工具创建项目:
tds init
根据提示输入相关信息,即可基于模板项目创建你的云引擎项目。
本地运行
首先在当前项目的目录下安装必要的依赖,执行如下命令行:
- JavaScript
- Python
- PHP
- Java
- C#
- Go
npm install
pip install -Ur requirements.txt
composer install
mvn package
// 需要安装 global.json 文件中指定的 .NET SDK 版本
go mod tidy && go mod vendor
然后启动应用:
tds up
访问站点
打开浏览器访问 http://localhost:3000 会显示如下内容:
- JavaScript
- Python
- PHP
- Java
- C#
- Go
LeanEngine
这是 LeanEngine 的示例应用
当前时间:Mon Feb 01 2016 18:23:36 GMT+0800 (CST)
一个简单的「TODO 列表」示例
LeanEngine
这是 LeanEngine 的示例应用
一个简单的动态路由示例
一个简单的「TODO 列表」示例
LeanEngine
这是 LeanEngine 的示例应用
当前时间:2016-07-25T14:55:17+08:00
一个简单的「TODO 列表」示例
LeanEngine
这是 LeanEngine 的示例应用
一个简单的动态路由示例
一个简单的「TODO 列表」示例
Welcome
Learn about building Web apps with ASP.NET Core.
LeanEngine
This is a LeanEngine demo application.
Current date: 2021-02-28 23:54:47.821183329 +0800 CST m=+1.093390203
A simple todo demo
访问页面的路由定义如下:
- JavaScript
- Python
- PHP
- Java
- C#
- Go
// ./app.js
// ...
app.get('/', function(req, res) {
res.render('index', { currentTime: new Date() });
});
// ...
# ./app.py
# ...
@app.route('/')
def index():
return render_template('index.html')
# ...
// ./src/app.php
// ...
$app->get('/', function (Request $request, Response $response) {
return $this->view->render($response, "index.phtml", array(
"currentTime" => new \DateTime(),
));
});
// ...
// ./src/main/webapp/WEB-INF/web.xml
// ...
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
// ...
// ./web/Startup.cs
// ...
app.UseEndpoints(endpoints => {
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
})
// ...
// ./main.go
// ...
e.GET("/", routes.Index)
// ...
// ./routes/index.go
// ...
func Index(c echo.Context) error {
return c.Render(http.StatusOK, "index", time.Now().String())
}
// ...