mirror of
https://onedev.site.tesses.net/crosslang/crosslangextras
synced 2026-02-08 17:15:45 +00:00
Add std
This commit is contained in:
@@ -8,16 +8,10 @@
|
||||
"homepage": "https://crosslang.tesseslanguage.com/",
|
||||
"license": "MIT",
|
||||
"template_name": "emptyweb",
|
||||
"description": "An empty website with my template engine",
|
||||
"description": "An empty website",
|
||||
"template_info": {
|
||||
"type": "console"
|
||||
},
|
||||
"template_project_dependencies": [
|
||||
{
|
||||
"name": "Tesses.CrossLang.Markup",
|
||||
"version": "1.0.0.0-prod"
|
||||
}
|
||||
],
|
||||
"template_extra_text_ftles": [],
|
||||
"template_ignored_files": ["bin","obj"]
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?page() route="/" ?>
|
||||
<?Shell?>
|
||||
<?arg_component() ?>
|
||||
<h1>Hello, world</h1>
|
||||
<span>Views: <?expr ++count ?></span>
|
||||
|
||||
<?end?>
|
||||
<?end?>
|
||||
<?end?>
|
||||
|
||||
14
Templates/emptyweb/src/components/shell.tcross
Normal file
14
Templates/emptyweb/src/components/shell.tcross
Normal file
@@ -0,0 +1,14 @@
|
||||
func Components.Shell(body)
|
||||
{
|
||||
return <!DOCTYPE html>
|
||||
<html lang={"en"}>
|
||||
<head>
|
||||
<meta charset={"UTF-8"}>
|
||||
<meta name={"viewport"} content={"width=device-width, initial-scale=1.0"}>
|
||||
<title>Hello, world</title>
|
||||
</head>
|
||||
<body>
|
||||
<raw(body)>
|
||||
</body>
|
||||
</html>;
|
||||
}
|
||||
9
Templates/emptyweb/src/pages/index.tcross
Normal file
9
Templates/emptyweb/src/pages/index.tcross
Normal file
@@ -0,0 +1,9 @@
|
||||
var count = 0;
|
||||
|
||||
func Pages.Index()
|
||||
{
|
||||
return Components.Shell(
|
||||
<h1>Hello, world</h1>
|
||||
<span>Views: {++count}</span>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,12 @@
|
||||
var count = 0;
|
||||
|
||||
func main(args)
|
||||
{
|
||||
Net.Http.ListenSimpleWithLoop(Router,4206);
|
||||
Net.Http.ListenSimpleWithLoop((ctx)=>{
|
||||
if(ctx.Path == "/")
|
||||
{
|
||||
ctx.WithMimeType("text/html").SendText(Pages.Index());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},4206);
|
||||
}
|
||||
Reference in New Issue
Block a user