// Import express and instantiate itimportexpressfrom"npm:express@4";const app =express();// Register a route
app.get("/",(req, res)=>{
res.send("Hello World!");});// Run the server!
app.listen(3000);
To show the live logs of a project's latest deployment:
deployctl logs --project=helloworld
To show the live logs of a particular deployment:
deployctl logs --project=helloworld --deployment=1234567890ab
To show the live error & info level logs of the production deployment generated in particular regions:
deployctl logs --project=helloworld --prod --levels=error,info --regions=region1,region2
To show the logs generated within the past two hours, up until 30 minutes ago, and containing the word "foo":
[Linux]
deployctl logs --project=helloworld --since=$(date -Iseconds --date='2 hours ago') --until=$(date -Iseconds --date='30 minutes ago') --grep=foo
[macOS]
deployctl logs --project=helloworld --since=$(date -Iseconds -v-2H) --until=$(date -Iseconds -v-30M) --grep=foo
有关选项的完整列表
--deployment=<DEPLOYMENT_ID> The id of the deployment you want to get the logs (defaults to latest deployment)
--prod Select the production deployment
-p, --project=NAME The project you want to get the logs
--token=TOKEN The API token to use (defaults to DENO_DEPLOY_TOKEN env var)
--since=<DATETIME> The start time of the logs you want to get. RFC3339 format (e.g. 2023-07-17T06:10:38+09:00) is supported.
NOTE: Logs generated over 24 hours ago are not available
--until=<DATETIME> The end time of the logs you want to get. RFC3339 format (e.g. 2023-07-17T06:10:38+09:00) is supported.
--grep=<WORD> Filter logs by a word
Multiple words can be specified for AND search. For example, "--grep=foo --grep=bar" will match logs containing both "foo" and "bar"
--levels=<LEVELS> Filter logs by log levels (defaults to all log levels)
Mutliple levels can be specified, e.g. --levels=info,error
--regions=<REGIONS> Filter logs by regions (defaults to all regions)
Multiple regions can be specified, e.g. --regions=region1,region2
--limit=<LIMIT> Limit the number of logs to return (defualts to 100)
This flag is effective only when --since and/or --until is specified
import{ serve }from"https://deno.land/[email protected]/http/server.ts";serve(async(req:Request)=>{const{ version }=awaitimport("https://deno.land/[email protected]/uuid/mod.ts");const ver =version("109156be-c4fb-41ea-b1b4-efe1671c5836");returnnewResponse(ver);});
import{ createServer }from"node:http";importprocessfrom"node:process";const server =createServer((req, res)=>{const message =`Hello from ${process.env.DENO_REGION} at ${newDate()}`;
res.end(message);});
server.listen(8080);