From a72423824024a43d40b804a0f9247908857541bb Mon Sep 17 00:00:00 2001 From: staticwebdev Date: Fri, 24 Apr 2020 10:10:44 -0400 Subject: [PATCH] initial commit --- .vscode/extensions.json | 6 +++ .vscode/launch.json | 12 +++++ .vscode/settings.json | 13 +++++ .vscode/tasks.json | 32 ++++++++++++ api/.funcignore | 7 +++ api/.gitignore | 94 ++++++++++++++++++++++++++++++++++++ api/GetMessage/function.json | 19 ++++++++ api/GetMessage/index.js | 6 +++ api/GetMessage/sample.dat | 3 ++ api/host.json | 7 +++ api/package-lock.json | 5 ++ api/package.json | 11 +++++ api/proxies.json | 4 ++ index.html | 25 ++++++++++ readme.md | 3 ++ styles.css | 25 ++++++++++ 16 files changed, 272 insertions(+) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 api/.funcignore create mode 100644 api/.gitignore create mode 100644 api/GetMessage/function.json create mode 100644 api/GetMessage/index.js create mode 100644 api/GetMessage/sample.dat create mode 100644 api/host.json create mode 100644 api/package-lock.json create mode 100644 api/package.json create mode 100644 api/proxies.json create mode 100644 index.html create mode 100644 readme.md create mode 100644 styles.css diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..6fe2648 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "ms-azuretools.vscode-azurefunctions", + "ritwickdey.LiveServer" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1c6e50d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,12 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Attach to Node Functions", + "type": "node", + "request": "attach", + "port": 9229, + "preLaunchTask": "func: host start" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..25bd7ab --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "azureFunctions.deploySubpath": "api", + "azureFunctions.postDeployTask": "npm install", + "azureFunctions.projectLanguage": "JavaScript", + "azureFunctions.projectRuntime": "~2", + "debug.internalConsoleOptions": "neverOpen", + "azureFunctions.preDeployTask": "npm prune", + "liveServer.settings.proxy": { + "enable": true, + "baseUri": "/api", + "proxyUri": "http://127.0.0.1:7071/api" + } +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e78ad55 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,32 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "func", + "command": "host start", + "problemMatcher": "$func-watch", + "isBackground": true, + "dependsOn": "npm install", + "options": { + "cwd": "${workspaceFolder}/api" + } + }, + { + "type": "shell", + "label": "npm install", + "command": "npm install", + "options": { + "cwd": "${workspaceFolder}/api" + } + }, + { + "type": "shell", + "label": "npm prune", + "command": "npm prune --production", + "problemMatcher": [], + "options": { + "cwd": "${workspaceFolder}/api" + } + } + ] +} \ No newline at end of file diff --git a/api/.funcignore b/api/.funcignore new file mode 100644 index 0000000..5179222 --- /dev/null +++ b/api/.funcignore @@ -0,0 +1,7 @@ +*.js.map +*.ts +.git* +.vscode +local.settings.json +test +tsconfig.json \ No newline at end of file diff --git a/api/.gitignore b/api/.gitignore new file mode 100644 index 0000000..772851c --- /dev/null +++ b/api/.gitignore @@ -0,0 +1,94 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-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 + +# 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/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TypeScript output +dist +out + +# Azure Functions artifacts +bin +obj +appsettings.json +local.settings.json \ No newline at end of file diff --git a/api/GetMessage/function.json b/api/GetMessage/function.json new file mode 100644 index 0000000..0321ee9 --- /dev/null +++ b/api/GetMessage/function.json @@ -0,0 +1,19 @@ +{ + "bindings": [ + { + "authLevel": "anonymous", + "type": "httpTrigger", + "direction": "in", + "name": "req", + "methods": [ + "get" + ], + "route": "message" + }, + { + "type": "http", + "direction": "out", + "name": "res" + } + ] +} \ No newline at end of file diff --git a/api/GetMessage/index.js b/api/GetMessage/index.js new file mode 100644 index 0000000..c604215 --- /dev/null +++ b/api/GetMessage/index.js @@ -0,0 +1,6 @@ +module.exports = async function (context, req) { + context.res = { + // status: 200, /* Defaults to 200 */ + body: { text: "Hello from the API" }, + }; +}; diff --git a/api/GetMessage/sample.dat b/api/GetMessage/sample.dat new file mode 100644 index 0000000..2e60943 --- /dev/null +++ b/api/GetMessage/sample.dat @@ -0,0 +1,3 @@ +{ + "name": "Azure" +} \ No newline at end of file diff --git a/api/host.json b/api/host.json new file mode 100644 index 0000000..d342a8e --- /dev/null +++ b/api/host.json @@ -0,0 +1,7 @@ +{ + "version": "2.0", + "extensionBundle": { + "id": "Microsoft.Azure.Functions.ExtensionBundle", + "version": "[1.*, 2.0.0)" + } +} diff --git a/api/package-lock.json b/api/package-lock.json new file mode 100644 index 0000000..0bb6c76 --- /dev/null +++ b/api/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "api", + "version": "1.0.0", + "lockfileVersion": 1 +} diff --git a/api/package.json b/api/package.json new file mode 100644 index 0000000..10f08ee --- /dev/null +++ b/api/package.json @@ -0,0 +1,11 @@ +{ + "name": "api", + "version": "1.0.0", + "description": "", + "scripts": { + "start": "func start", + "test": "echo \"No tests yet...\"" + }, + "dependencies": {}, + "devDependencies": {} +} diff --git a/api/proxies.json b/api/proxies.json new file mode 100644 index 0000000..b385252 --- /dev/null +++ b/api/proxies.json @@ -0,0 +1,4 @@ +{ + "$schema": "http://json.schemastore.org/proxies", + "proxies": {} +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..6cbfc9a --- /dev/null +++ b/index.html @@ -0,0 +1,25 @@ + + + + + + + Vanilla JavaScript App + + + +
+

Vanilla JavaScript App

+

Loading content from the API:

+
+ + + + diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..f9f4e00 --- /dev/null +++ b/readme.md @@ -0,0 +1,3 @@ +# Vanilla API App + +This repo is used as a starter for a _very basic_ web application with an API. diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..78dcd2d --- /dev/null +++ b/styles.css @@ -0,0 +1,25 @@ +* { + font-family: Arial, Helvetica, sans-serif; +} + +html, +body { + margin: 0; + border: 0; + padding: 0; + background-color: #fff; +} + +main { + margin: auto; + width: 50%; + padding: 20px; +} + +main { + text-align: center; +} + +h1 { + font-size: 3.5em; +}