├── deno.json
├── package.json
├── .gitignore
├── index.js
├── LICENSE
├── readme.md
└── index.html
/deno.json:
--------------------------------------------------------------------------------
1 | {
2 | "tasks": {
3 | "start": "deno run --allow-all index.js"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "deno starter",
3 | "scripts": {
4 | "start": "deno run --allow-all index.js"
5 | },
6 | "devDependencies": {
7 | "deno-bin": "^1.28.2"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # dependencies
2 | node_modules/
3 |
4 | # logs
5 | npm-debug.log*
6 | yarn-debug.log*
7 | yarn-error.log*
8 | pnpm-debug.log*
9 |
10 | # environment variables
11 | .env
12 | .env.production
13 |
14 | # macOS-specific files
15 | .DS_Store
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
2 |
3 | const argPort = Deno.env.get("PORT") ? Number(Deno.env.get("PORT")) : 8000;
4 |
5 | serve(
6 | async (_req) => {
7 | const body = (await Deno.open("index.html")).readable;
8 |
9 | return new Response(body, {
10 | headers: {
11 | "content-type": 'text/html; charset=UTF-8',
12 | },
13 | });
14 | },
15 | { port: argPort },
16 | );
17 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Kinsta Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Kinsta - Hello World - Deno
2 |
3 | An example of how to deploy a **Deno** application build on Kinsta.
4 |
5 | ---
6 |
7 | Kinsta is a developer-centric cloud host / PaaS. We’re striving to make it easier for you to share your web projects with your users. Focus on coding and building, and we’ll take care of deployment and provide fast, scalable hosting. + 24/7 expert-only support.
8 |
9 | - [Start your free trial](https://kinsta.com/signup/?product_type=app-db)
10 | - [Application Hosting](https://kinsta.com/application-hosting)
11 | - [Database Hosting](https://kinsta.com/database-hosting)
12 |
13 | ## Dependency Management
14 |
15 | Kinsta automatically installs dependencies defined in your `package.json` file during the deployment process,
16 |
17 | ## Web Server Setup
18 |
19 | ### Port
20 |
21 | Kinsta automatically sets the `PORT` environment variable. You should **not** define it yourself and you should **not** hard-code it into the application.
22 |
23 | ### Start Command
24 |
25 | When deploying an application, Kinsta automatically creates a web process with `npm start` as the entry point. Make sure to use this command to run your server.
26 |
27 | ## Deployment Lifecycle
28 |
29 | Whenever a deployment is initiated (through creating an application or re-deploying due to an incoming commit) the `npm build` command is run, followed by the `npm start` command.
30 |
31 | ## What is Deno
32 |
33 | Deno is a JavaScript, TypeScript, and WebAssembly runtime that allows you to run code outside of a web browser that allows you to build secure server-side applications. More information is available on the [Deno.land](https://deno.land/) website.
34 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |