mirror of
https://onedev.site.tesses.net/crosslang/crosslang-tutorials
synced 2026-02-08 17:15:46 +00:00
First commit
This commit is contained in:
22
2 Embedding files/src/main.tcross
Normal file
22
2 Embedding files/src/main.tcross
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
func WebAppMain(args)
|
||||
{
|
||||
return (ctx)=>{
|
||||
if(ctx.Path == "/")
|
||||
{
|
||||
ctx.WithMimeType("text/html").SendText(<img src="mountain.jpg">);
|
||||
return true;
|
||||
}
|
||||
else if(ctx.Path == "/mountain.jpg")
|
||||
{
|
||||
var mypicture = embed("mountain.jpg");
|
||||
ctx.WithMimeType("image/jpeg").SendBytes(mypicture);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
func main(args)
|
||||
{
|
||||
Console.WriteLine("use crosslang webapp-test to test");
|
||||
}
|
||||
Reference in New Issue
Block a user