-
Notifications
You must be signed in to change notification settings - Fork 125
feat: Hello, World! function #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
e9d8723
7b29b53
7ec34dc
7856b2c
b1c6e85
59faada
288a6c0
727773c
cf2b11c
f9eaa2e
76228cd
1912651
7fd9bea
10376d1
cac7b93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| lerna-debug.log* | ||
| .pnpm-debug.log* | ||
|
|
||
| # Diagnostic reports (https://nodejs.org/api/report.html) | ||
| report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Directory for instrumented libs generated by jscoverage/JSCover | ||
| lib-cov | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage | ||
| *.lcov | ||
|
|
||
| # nyc test coverage | ||
| .nyc_output | ||
|
|
||
| # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
| .grunt | ||
|
|
||
| # Bower dependency directory (https://bower.io/) | ||
| bower_components | ||
|
|
||
| # node-waf configuration | ||
| .lock-wscript | ||
|
|
||
| # Compiled binary addons (https://nodejs.org/api/addons.html) | ||
| build/Release | ||
|
|
||
| # Dependency directories | ||
| node_modules/ | ||
| jspm_packages/ | ||
|
|
||
| # Snowpack dependency directory (https://snowpack.dev/) | ||
| web_modules/ | ||
|
|
||
| # TypeScript cache | ||
| *.tsbuildinfo | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
| # Optional eslint cache | ||
| .eslintcache | ||
|
|
||
| # Optional stylelint cache | ||
| .stylelintcache | ||
|
|
||
| # Microbundle cache | ||
| .rpt2_cache/ | ||
| .rts2_cache_cjs/ | ||
| .rts2_cache_es/ | ||
| .rts2_cache_umd/ | ||
|
|
||
| # Optional REPL history | ||
| .node_repl_history | ||
|
|
||
| # Output of 'npm pack' | ||
| *.tgz | ||
|
|
||
| # Yarn Integrity file | ||
| .yarn-integrity | ||
|
|
||
| # dotenv environment variable files | ||
| .env | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
| .env.local | ||
|
|
||
| # parcel-bundler cache (https://parceljs.org/) | ||
| .cache | ||
| .parcel-cache | ||
|
|
||
| # Next.js build output | ||
| .next | ||
| out | ||
|
|
||
| # Nuxt.js build / generate output | ||
| .nuxt | ||
| dist | ||
|
|
||
| # Gatsby files | ||
| .cache/ | ||
| # Comment in the public line in if your project uses Gatsby and not Next.js | ||
| # https://nextjs.org/blog/next-9-1#public-directory-support | ||
| # public | ||
|
|
||
| # vuepress build output | ||
| .vuepress/dist | ||
|
|
||
| # vuepress v2.x temp and cache directory | ||
| .temp | ||
| .cache | ||
|
|
||
| # Docusaurus cache and generated files | ||
| .docusaurus | ||
|
|
||
| # Serverless directories | ||
| .serverless/ | ||
|
|
||
| # FuseBox cache | ||
| .fusebox/ | ||
|
|
||
| # DynamoDB Local files | ||
| .dynamodb/ | ||
|
|
||
| # TernJS port file | ||
| .tern-port | ||
|
|
||
| # Stores VSCode versions used for testing VSCode extensions | ||
| .vscode-test | ||
|
|
||
| # yarn v2 | ||
| .yarn/cache | ||
| .yarn/unplugged | ||
| .yarn/build-state.yml | ||
| .yarn/install-state.gz | ||
| .pnp.* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "trailingComma": "es5", | ||
| "tabWidth": 2, | ||
| "semi": false, | ||
| "singleQuote": true | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Hello World Function | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would love to give READMes structure. Ideally it should have all information developer would need to install it, configure it, and use it. Here is my proposal, let me know what you think:
Ideally we would have template README somewhere, so when we make new template, we use that as the base |
||
|
|
||
| This is a simple function that returns a "Hello, World!" message. | ||
|
|
||
| Navigate to the function in the browser, you should see a basic "Hello, World!" page. | ||
|
|
||
| Send a POST request to the function, and you will get a response that looks like this: | ||
| ```json | ||
| { | ||
| "message": "Hello, World!" | ||
| } | ||
| ``` | ||
|
|
||
| The function also logs 'Hello, World' to the console. | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "name": "hello-world", | ||
| "version": "1.0.0", | ||
| "description": "", | ||
| "main": "src/main.js", | ||
| "type": "module", | ||
| "scripts": { | ||
| "format": "prettier --write src/**/*.js" | ||
|
loks0n marked this conversation as resolved.
loks0n marked this conversation as resolved.
|
||
| }, | ||
| "author": "", | ||
| "license": "MIT", | ||
|
loks0n marked this conversation as resolved.
Outdated
|
||
| "devDependencies": { | ||
| "prettier": "^3.0.0" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import fs from 'fs' | ||
| import path from 'path' | ||
| import { fileURLToPath } from 'url' | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url) | ||
| const __dirname = path.dirname(__filename) | ||
|
|
||
| const staticFolder = path.join(__dirname, '../static') | ||
|
|
||
| export default async ({ req, res, log }) => { | ||
|
loks0n marked this conversation as resolved.
Outdated
loks0n marked this conversation as resolved.
Outdated
|
||
| log('Hello, World! 👋') | ||
|
loks0n marked this conversation as resolved.
Outdated
|
||
|
|
||
| if (req.method === 'GET') { | ||
| const html = fs | ||
| .readFileSync(path.join(staticFolder, 'index.html')) | ||
| .toString() | ||
| return res.send(html, 200, { 'Content-Type': 'text/html; charset=utf-8' }) | ||
| } | ||
|
|
||
| return res.json({ | ||
| message: 'Hello, World! 👋', | ||
| }) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Hello, World!</title> | ||
| <link rel="stylesheet" href="https://unpkg.com/@appwrite.io/pink" /> | ||
| <link | ||
| rel="stylesheet" | ||
| href="https://unpkg.com/@appwrite.io/pink-icons" | ||
| /> | ||
| </head> | ||
| <body> | ||
| <main class="main-content"> | ||
| <div class="top-cover u-padding-block-end-56"> | ||
| <div class="container"> | ||
| <div | ||
| class="u-flex u-gap-16 u-flex-justify-center u-margin-block-start-16" | ||
| > | ||
| <h1 class="heading-level-1">Hello, World!</h1> | ||
| <code class="u-un-break-text"></code> | ||
| </div> | ||
| <p | ||
| class="body-text-1 u-normal u-margin-block-start-8" | ||
| style="max-width: 50rem" | ||
| > | ||
| This is a simple example of how to use Appwrite | ||
| functions. Modify the <code>src/index.php</code> file to | ||
|
loks0n marked this conversation as resolved.
Outdated
|
||
| add your own logic. | ||
| </p> | ||
| </div> | ||
| </div> | ||
| </main> | ||
| </body> | ||
| </html> | ||
Uh oh!
There was an error while loading. Please reload this page.