This commit is contained in:
Bowden 2018-10-03 14:48:51 -07:00
Коммит eb7e96b77f
26 изменённых файлов: 1547 добавлений и 0 удалений

330
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,330 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/

3
.vscode/extensions.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
{
"recommendations": ["ms-azuretools.vscode-azureappservice"]
}

14
.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/src/server.js"
}
]
}

3
.vscode/settings.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
{
"appService.defaultWebAppToDeploy": "None"
}

21
LICENSE.md Normal file
Просмотреть файл

@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

45
README.md Normal file
Просмотреть файл

@ -0,0 +1,45 @@
# Getting Started
This is a very simple Node application that uses the Express framework. It is designed to work well with [Visual Studio Code](https://code.visualstudio.com) and to be easily deployed to [Azure App Service](https://azure.microsoft.com/en-us/services/app-service/), Azure's fully-managed Platform as a Service (PaaS) that let's you deploy and scale web, mobile, and API apps.
## Running the Application
After cloning the [repository](`https://github.com/microsoft/vscode-tas-express`), install the necessary dependencies and then run the application:
``` console
npm install
npm start
```
By default, the server listens on port 3000, so point your favorite browser to `http://localhost:3000`.
In VS Code, simply press `F5` to launch the application in debug mode. Set a breakpoint and refresh the page to hit the breakpoint. From there, inspect variables, set watches, browse the call stack, and more. You can find more information about building and debugging Node applications, please see the [VS Code documentation](https://code.visualstudio.com/docs/azure/deployment).
## Deploy to the Cloud
When you first open this folder in VS Code, you'll be prompted to install the [Azure App Service extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice).
The App Service extension lets you quickly quickly create sites, deploy them, view logs, and even set environment variables (such as a Connection String), right from within VS Code. For more information, see the [App Service Walkthrough](https://code.visualstudio.com/tutorials/app-service-extension/getting-started).
## Additional Documentation
More information on building and deploying Node applications to Azure can be found on the [Node Developer Center](https://docs.microsoft.com/en-us/javascript/azure/?view=azure-node-latest).
# Contributing
This sample's code is hosted on GitHub: https://github.com/microsoft/vscode-tas-express.
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
## License
[MIT](LICENSE.md)

1
metadata.json Normal file
Просмотреть файл

@ -0,0 +1 @@
{}

423
package-lock.json сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,423 @@
{
"name": "express-on-azure",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"accepts": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
"integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
"requires": {
"mime-types": "~2.1.18",
"negotiator": "0.6.1"
}
},
"array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"body-parser": {
"version": "1.18.3",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
"integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=",
"requires": {
"bytes": "3.0.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "~1.6.3",
"iconv-lite": "0.4.23",
"on-finished": "~2.3.0",
"qs": "6.5.2",
"raw-body": "2.3.3",
"type-is": "~1.6.16"
},
"dependencies": {
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
}
}
},
"bytes": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
"integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
},
"content-disposition": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
"integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
},
"content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
},
"cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"destroy": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
},
"express": {
"version": "4.16.3",
"resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz",
"integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=",
"requires": {
"accepts": "~1.3.5",
"array-flatten": "1.1.1",
"body-parser": "1.18.2",
"content-disposition": "0.5.2",
"content-type": "~1.0.4",
"cookie": "0.3.1",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "~1.1.2",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "1.1.1",
"fresh": "0.5.2",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
"parseurl": "~1.3.2",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.3",
"qs": "6.5.1",
"range-parser": "~1.2.0",
"safe-buffer": "5.1.1",
"send": "0.16.2",
"serve-static": "1.13.2",
"setprototypeof": "1.1.0",
"statuses": "~1.4.0",
"type-is": "~1.6.16",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"dependencies": {
"body-parser": {
"version": "1.18.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz",
"integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=",
"requires": {
"bytes": "3.0.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.1",
"http-errors": "~1.6.2",
"iconv-lite": "0.4.19",
"on-finished": "~2.3.0",
"qs": "6.5.1",
"raw-body": "2.3.2",
"type-is": "~1.6.15"
}
},
"iconv-lite": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz",
"integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ=="
},
"raw-body": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz",
"integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=",
"requires": {
"bytes": "3.0.0",
"http-errors": "1.6.2",
"iconv-lite": "0.4.19",
"unpipe": "1.0.0"
},
"dependencies": {
"depd": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz",
"integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k="
},
"http-errors": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz",
"integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=",
"requires": {
"depd": "1.1.1",
"inherits": "2.0.3",
"setprototypeof": "1.0.3",
"statuses": ">= 1.3.1 < 2"
}
},
"setprototypeof": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz",
"integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ="
}
}
}
}
},
"finalhandler": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
"requires": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"on-finished": "~2.3.0",
"parseurl": "~1.3.2",
"statuses": "~1.4.0",
"unpipe": "~1.0.0"
}
},
"forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
},
"fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"http-errors": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.0",
"statuses": ">= 1.4.0 < 2"
}
},
"iconv-lite": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ipaddr.js": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz",
"integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs="
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
},
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
},
"mime": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
"integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
},
"mime-db": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
"integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ=="
},
"mime-types": {
"version": "2.1.18",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
"integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
"requires": {
"mime-db": "~1.33.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"negotiator": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"requires": {
"ee-first": "1.1.1"
}
},
"parseurl": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
"integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
},
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"proxy-addr": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz",
"integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==",
"requires": {
"forwarded": "~0.1.2",
"ipaddr.js": "1.6.0"
}
},
"qs": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
"integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A=="
},
"range-parser": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
"integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
},
"raw-body": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
"integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
"requires": {
"bytes": "3.0.0",
"http-errors": "1.6.3",
"iconv-lite": "0.4.23",
"unpipe": "1.0.0"
}
},
"safe-buffer": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"send": {
"version": "0.16.2",
"resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
"integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
"requires": {
"debug": "2.6.9",
"depd": "~1.1.2",
"destroy": "~1.0.4",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "~1.6.2",
"mime": "1.4.1",
"ms": "2.0.0",
"on-finished": "~2.3.0",
"range-parser": "~1.2.0",
"statuses": "~1.4.0"
}
},
"serve-static": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
"integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
"requires": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.2",
"send": "0.16.2"
}
},
"setprototypeof": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
},
"statuses": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
},
"type-is": {
"version": "1.6.16",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz",
"integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==",
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.18"
}
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
}
}
}

23
package.json Normal file
Просмотреть файл

@ -0,0 +1,23 @@
{
"name": "express-on-azure",
"version": "1.0.0",
"description": "A sample application for Azure using the Express framework",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/microsoft/vscode-tas-express.git"
},
"author": "Brian Terlson",
"license": "MIT",
"bugs": {
"url": "https://github.com/microsoft/vscode-tas-express/issues"
},
"homepage": "https://github.com/microsoft/vscode-tas-express#readme",
"dependencies": {
"body-parser": "^1.18.3",
"express": "^4.16.3"
}
}

3
process.json Normal file
Просмотреть файл

@ -0,0 +1,3 @@
{
"script": "server.js"
}

Просмотреть файл

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg1660"
version="1.1"
viewBox="0 0 67.73334 67.733335"
height="256"
width="256.00003">
<defs
id="defs1654" />
<metadata
id="metadata1657">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-42.484514,-90.776192)"
id="layer1">
<g
transform="matrix(0.70555554,0,0,0.70555554,-409.66391,54.337164)"
style="fill:#2db261"
id="g8375">
<path
style="color:#000000;stroke-width:1.50000012"
d="m 712.84034,51.645868 v 96.000002 l 23.99997,-9.98437 V 61.629877 Z"
id="path6367" />
<path
style="color:#000000;stroke-width:0.37500003;stroke-dasharray:0.37500002, 0.75000004;stroke-dashoffset:0.25999999"
d="m 640.8403,123.40352 96.00001,14.25798 -23.99997,9.98437 z"
id="path6369" />
<g
style="fill:#2db261;stroke-width:9.48558712"
transform="matrix(0.10546875,0,0,0.10537746,646.84031,65.69261)"
id="g3435">
<path
style="color:#000000;stroke-width:75.88469696"
d="M 386.82422,0 V 512 L 512,458.75 V 53.248047 Z"
id="path3209-9" />
<path
style="color:#000000;stroke-width:18.97117424"
d="M 51.875,400.0462 512,53.248047 386.82422,2.9999967e-6 0,382.70744 Z"
id="path3238-3" />
<path
style="color:#000000;stroke-width:18.97117424"
d="M 0,129.31055 386.82422,512 512,458.75 51.875,111.9707 Z"
id="path3240-60" />
</g>
</g>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Просмотреть файл

@ -0,0 +1,3 @@
<svg width="74" height="74" viewBox="0 0 74 74" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.6543 21.0299L43.7832 0L15.8792 50.9066L0 52.5022L18.6543 21.0299ZM34.9958 30.7471L45.9417 8.7022L74 57.7234L18.5 57.1428L54.2668 53.0823L34.9958 30.7471Z" transform="translate(0 8.14)" fill="#156bda"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 358 B

Двоичные данные
public/images/code-insiders.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичные данные
public/images/commit.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 97 KiB

Двоичные данные
public/images/edit-debug.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 109 KiB

Двоичные данные
public/images/edit-screenshot.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 78 KiB

Двоичные данные
public/images/edit.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.1 KiB

Двоичные данные
public/images/favicon.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Просмотреть файл

@ -0,0 +1,3 @@
<svg width="74" height="74" viewBox="0 0 74 74" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M72.6215 33.7406L40.2648 1.38825C38.4135 -0.462751 35.3549 -0.462751 33.5037 1.38825L26.8231 8.06797L35.3549 16.5987C37.3672 15.9549 39.6209 16.3573 41.1502 17.9668C42.7599 19.5764 43.1624 21.8298 42.5185 23.8418L50.7284 32.0506C52.7406 31.4067 54.9943 31.8091 56.6041 33.4187C58.8578 35.5916 58.8578 39.2132 56.6041 41.4666C54.3504 43.72 50.8089 43.72 48.5552 41.4666C46.8649 39.7765 46.4624 37.3622 47.3478 35.2697L39.7013 27.6243V47.7439C40.2648 47.9853 40.7477 48.3877 41.2306 48.7901C43.4843 50.963 43.4843 54.5846 41.2306 56.838C38.9769 59.0109 35.4354 59.0109 33.1817 56.838C30.928 54.5846 30.928 51.0435 33.1817 48.7901C33.7451 48.2268 34.389 47.8244 35.033 47.5829V27.2219C34.389 26.9804 33.7451 26.4976 33.1817 26.0147C31.4914 24.3246 31.089 21.9103 31.9744 19.8178L23.523 11.4481L1.38844 33.5797C-0.462813 35.4307 -0.462813 38.4889 1.38844 40.3399L33.6646 72.6117C35.5159 74.4628 38.5745 74.4628 40.4257 72.6117L72.541 40.5008C74.4727 38.5693 74.4727 35.5916 72.6215 33.7406Z" fill="#EE523B"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -0,0 +1,4 @@
<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M44.3323 100C42.9555 100 41.6705 99.6329 40.4773 98.9904L28.2698 91.7393C26.4341 90.7297 27.352 90.3626 27.9027 90.179C30.3809 89.3529 30.8398 89.1693 33.4098 87.7008C33.6852 87.5172 34.0523 87.609 34.3277 87.7926L43.6898 93.3915C44.0569 93.575 44.5158 93.575 44.7912 93.3915L81.4135 72.1891C81.7806 72.0055 81.9642 71.6384 81.9642 71.1794V28.7747C81.9642 28.3157 81.7806 27.9486 81.4135 27.765L44.9748 6.65443C44.6076 6.47086 44.1487 6.47086 43.8733 6.65443L7.25103 27.765C6.88389 27.9486 6.70032 28.4075 6.70032 28.7747V71.0877C6.70032 71.4548 6.88389 71.9137 7.25103 72.0973L17.2556 77.8798C22.6709 80.6333 26.067 77.4208 26.067 74.2084V32.4461C26.067 31.8954 26.5259 31.3447 27.1684 31.3447H31.8495C32.4002 31.3447 32.9509 31.8036 32.9509 32.4461V74.2084C32.9509 81.4594 29.0041 85.6815 22.1202 85.6815C20.0092 85.6815 18.357 85.6815 13.676 83.3869L4.03855 77.8798C1.46856 76.4112 0 73.8412 0 71.0877V28.7747C0 26.0211 1.46856 23.4511 3.85498 22.0743L40.4773 0.963745C42.7719 -0.321248 45.8926 -0.321248 48.1872 0.963745L84.8095 22.1661C87.196 23.5429 88.6645 26.1129 88.6645 28.8665V71.1794C88.6645 73.933 87.196 76.503 84.8095 77.8798L48.1872 99.0821C47.0858 99.6329 45.709 100 44.3323 100Z" transform="translate(6)" fill="white"/>
<path d="M19.3667 40.6609C3.30427 40.6609 -1.40053e-06 33.318 -1.40053e-06 27.0766C-1.40053e-06 26.5259 0.458925 25.9752 1.10142 25.9752H5.87425C6.42497 25.9752 6.88389 26.3424 6.88389 26.8931C7.61817 31.7577 9.72923 34.1441 19.4585 34.1441C27.1684 34.1441 30.4727 32.4002 30.4727 28.2698C30.4727 25.8834 29.5548 24.1395 17.531 22.9463C7.34282 22.0285 1.19321 19.8256 1.19321 11.8403C1.19321 4.40569 7.4346 0 17.8981 0C29.6466 0 35.4291 4.03855 36.1634 12.8499C36.1634 13.1253 36.0716 13.4006 35.888 13.676C35.7045 13.8596 35.4291 14.0431 35.1537 14.0431H30.3809C29.922 14.0431 29.4631 13.676 29.3713 13.2171C28.2698 8.16889 25.4245 6.51675 17.8981 6.51675C9.45388 6.51675 8.44424 9.45388 8.44424 11.6567C8.44424 14.3185 9.63745 15.1446 21.0188 16.6131C32.3084 18.0817 37.6319 20.1927 37.6319 28.0863C37.6319 36.0716 30.9316 40.6609 19.3667 40.6609Z" transform="translate(42.3469 30.2432)" fill="white"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Просмотреть файл

@ -0,0 +1,3 @@
<svg width="74" height="74" viewBox="0 0 74 74" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M74 7.696V66.304L55.5 74L0 55.315L55.5 63.5586V0L74 7.696ZM4.625 41.9155L15.0368 31.6239L4.625 21.3323L8.843 19.9245L19.0772 27.6316L36.075 10.8281L46.25 15.1533V48.1L36.075 52.4253L19.0791 35.6255L8.843 43.3233L4.625 41.9155ZM24.3793 31.6239L36.0732 40.4299V22.8179L24.3793 31.6239Z" fill="#0078D7"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 414 B

57
public/script.js Normal file
Просмотреть файл

@ -0,0 +1,57 @@
Date.prototype.addHours = function(h) {
this.setTime(this.getTime() + (h*60*60*1000));
return this;
}
function timeTo(ts) {
var date = new Date();
var now_utc = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(),
date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
const t = Date.parse(ts) - Date.parse(new Date(now_utc));
const minutes = Math.floor(t / 1000 / 60);
const seconds = (t - minutes * 60 * 1000) / 1000;
return {
minutes,
seconds
};
}
function timeToString(ts) {
const rec = timeTo(ts);
return `${rec.minutes}`; // minutes`; // ${rec.seconds} sec`;
}
setInterval(() => {
const el = document.getElementById('timeLeft');
el.textContent = timeToString(expiryTime);
}, 1000);
document.addEventListener('DOMContentLoaded', () => {
// set up the clone URLs.
const clone = document.getElementById('clone');
clone.setAttribute(
'href',
'vscode://vscode.git/clone?url=' + encodeURIComponent(env.gitUrl)
);
const cloneInsiders = document.getElementById('clone-insiders');
cloneInsiders.setAttribute(
'href',
'vscode-insiders://vscode.git/clone?url=' + encodeURIComponent(env.gitUrl)
);
const host = document.getElementById('host');
host.textContent = document.location.href;
const creds = document.getElementById('creds');
if (navigator.platform === 'Win32') {
creds.textContent = env.gitUrl;
} else {
creds.textContent = env.bashGitUrl;
}
const showCreds = document.getElementById('show-creds');
showCreds.addEventListener('click', function(e) {
e.preventDefault();
creds.setAttribute('style', '');
});
});

319
public/style.css Normal file
Просмотреть файл

@ -0,0 +1,319 @@
/* === Global === */
html,
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial,
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
font-size: 14px;
line-height: 1.5;
color: #333;
background-color: #fff;
}
* {
margin: 0;
padding: 0;
}
a {
color: #0078d4;
}
/* === HERO === */
#hero {
padding: 0 32px 32px;
text-align: center;
color: white;
background: #0078d4;
}
#hero img {
/* padding: 50px 0 0 0; */
width: 60px;
margin-bottom: 12px;
/* animation: logo-spin infinite 10s linear; */
}
#hero h1 {
font-size: 28px;
font-weight: 600;
}
#hero p {
margin-top: 4px;
font-weight: lighter;
}
#hero #countdown {
padding: 16px 0;
margin: 0;
text-align: right;
font-size: 11px;
background-color: #0078d4;
font-weight: lighter
}
#hero a {
color: white;
}
/* === Content === */
.content {
margin: 0 auto;
max-width: 1600px;
padding-top: 30px;
display: flex;
align-content: center;
}
.content2 {
margin: 0 auto;
max-width: 1600px;
display: flex;
align-content: center;
}
#content h2 {
font-size: 22px;
text-align: center;
}
.column {
margin: 0 10px;
width: calc(100% / 3);
padding: 30px 24px;
display: flex;
}
@media (max-width: 1110px) {
.column {
width: 100%;
padding: 20px 24px;
}
.content {
display: block;
}
.content2 {
display: block;
padding-top: 0px;
margin-top: 0px;
}
}
.empty {
padding-top: 0px;
padding-bottom: 0px;
margin-top: 0px;
margin-bottom: 0px;
}
/* .column:first-child {
margin-left: 0;
}
.column:last-child {
margin-right: 0;
} */
.column .icon {
float: left;
margin-right: 12px;
flex-direction: row;
width: 10px;
padding-right: 12px;
}
.column .icon img {
width: 20px;
}
.column p {
margin: 0px;
}
.column .title {
font-size: 20px;
font-weight: 600;
}
.column .description,
.column .link {
font-size: 12px;
margin-top:10px;
}
.column .description {
margin: 2px 0 8px;
color: #666;
}
#creds {
overflow-y: hidden;
overflow-x: scroll;
}
/* === Responsive === */
@media only screen and (max-width: 768px) {
#content,
.column {
flex-direction: column;
}
#content .column {
width: 100%;
margin: 0;
padding: 32px 0;
}
.column img {
width: 60px;
}
#content .column:first-child {
padding-top: 0;
}
.column .title {
margin-top: 12px;
}
}
/* === Animation === */
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.continue-section {
width: 530px;
display: flex;
}
.continue-column {
margin-left: 24px;
}
.continue-section .title {
font-size: 16px;
font-weight: 600;
}
.continue-section .description,
.continue-section .link {
font-size: 12px;
}
.continue-section .description {
margin: 2px 0 8px;
color: #666;
}
.numberCircle {
min-width: 32px;
display: table-cell;
text-align: center;
vertical-align: middle;
border-radius: 50%;
width: 32px;
height: 32px;
padding: 5px;
border: 2px solid #0078d4;
color: #0078d4;
text-align: center;
font-size: 16px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 200%;
margin-left: 5px;
margin-right: 15px;
}
.numberCircle-Light {
min-width: 32px;
display: table-cell;
text-align: center;
vertical-align: middle;
border: 2px solid #fff;
border-radius: 50%;
width: 32px;
height: 32px;
padding: 5px;
color: #fff;
text-align: center;
font-size: 32px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 200%;
margin-left: 5px;
margin-right: 15px;
}
hr {
width: 50%;
margin: 0 auto;
}
#hero h2 {
font-weight: normal;
}
code {
color: white;
padding: 8px;
}
.codeblock {
background-color: black;
width: 350px;
padding: 4px 0px;
}
.content-wrapper {
background-color: #fafafa;
}
.content-wrapper-light {
background-color: white
}
.continue-btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: lighter;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
color: #fff;
background-color: #0078d4;
border-color: #0078d4;
margin-top: 10px ;
display: flex;
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
}
.centered {
margin: 0 auto;
}
.code {
font-family: 'Courier New', Courier, monospace
}

70
server.js Normal file
Просмотреть файл

@ -0,0 +1,70 @@
// @ts-check
var util = require('./util');
const express = require('express');
const http = require('http');
var bodyParser = require("body-parser");
async function main() {
let expiryTimestamp;
if (!process.env['SITE_EXPIRY_UTC'] || !process.env['USER_GUID']) {
let fileData = (await util.readMetadataFile());
process.env['SITE_EXPIRY_UTC'] = fileData.expiryTimestamp;
process.env['USER_GUID'] = fileData.userGuid;
}
// Azure App Service will set process.env.port for you, but we use 3000 in development.
const PORT = process.env.PORT || 3000;
// Create the express routes
let app = express();
app.use(express.static('public'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.get('/:userGuid', async (req, res) => {
let vars = {
gitUrl: req.params.userGuid == process.env['APPSETTING_SITE_SITEKEY'] ? process.env['APPSETTING_SITE_GIT_URL'] : "Incorrect url param",
bashGitUrl: req.params.userGuid == process.env['APPSETTING_SITE_SITEKEY'] ? process.env['APPSETTING_SITE_BASH_GIT_URL'] : "Incorrect url param",
expiry: process.env['SITE_EXPIRY_UTC'],
host: process.env['HTTP_HOST']
};
let indexContent = await util.loadEnvironmentVariables(vars);
res.end(indexContent);
});
app.get('/', async(req, res) => {
let indexContent = await util.loadEnvironmentVariables({
gitUrl: "Supply a guid in the url for git write access",
bashGitUrl: "Supply a guid in the url for git write access",
expiry: process.env['SITE_EXPIRY_UTC'],
host: process.env['HTTP_HOST']
});
res.end(indexContent);
});
/**
* Try app service uses this endpoint to set remaining trial time and set a guid so that only
* the assigned user can access the git credentials
*/
app.put('/api/metadata', (req, res) => {
if (req.body.userGuid == process.env['APPSETTING_SITE_SITEKEY']) {
if (req.body.timestamp) {
process.env['SITE_EXPIRY_UTC'] = req.body.timestamp;
}
util.updateMetadataFile(req.body.timestamp, req.body.guid);
res.end("Successfully updated meta-data");
} else {
res.send(401);
}
});
// Create the HTTP server.
let server = http.createServer(app);
server.listen(PORT, function () {
console.log(`Listening on port ${PORT}`);
});
}
main();

135
template.html Normal file
Просмотреть файл

@ -0,0 +1,135 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="./images/favicon.ico" type="image/x-icon">
<link rel="icon" href="./images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="style.css">
<script src="./script.js"></script>
<script>{ envVars }</script>
<script>var date = new Date();
var now_utc = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(),
date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
let expiryTime = new Date(Math.min(Date.parse(env.expiry), Date.parse(new Date(now_utc).addHours(1))));</script>
<title>Express App</title>
</head>
<body>
<!-- Hero -->
<div id="hero">
<p id="countdown">This <strong>free</strong> web application will expire in
<strong id="timeLeft">...</strong>
minutes...
</p>
<img src="./images/node-logo.svg" alt="Azure App Service">
<!-- Make some edits!! -->
<h1> Welcome to Azure! </h1>
<p>This is a simple Node application using the popular <a href="https://expressjs.com/" target="_blank"rel="noopener noreferrer">Express</a> framework, hosted on Azure App Service at <a href="/"
id='host'></a></p>
<p>To get started, follow the instructions below or jump straight to the <a href="https://aka.ms/tas-walkthrough"
target="_blank"rel="noopener noreferrer">walkthrough</a></p>
</div>
<!-- Content -->
<div>
<div class="content-wrapper">
<div class="content">
<div class="column">
<div class="numberCircle">
1
</div>
<div>
<p class="title">Get the code</p>
<p> Clone the sources using Visual Studio Code or use git from the command line.</p>
<div>
<p class="link">
<a href="#" id="clone">Clone with VS Code</a>
</p>
</div>
<div>
<p class="link">
<a href="#" id="clone-insiders">Clone with VS Code Insiders</a>
</p>
</div>
<div>
<p class="link">
<a href="#" id="show-creds">Generate your Git credentials</a>
</p>
<p id="creds" style="display: none"></p>
</div>
</div>
</div>
<div class="column">
<div class="numberCircle">
2
</div>
<div>
<p class="title">Make some changes</p>
<p> Edit <span class="code">template.html</span> and run <span class="code">npm start</span> (or press F5 in VS Code!) to run the application locally.</p>
<div>
<p class="link">
<a href="https://code.visualstudio.com/docs/editor/codebasics" target="_blank" rel="noopener noreferrer">Editing in VS Code</a>
</p>
</div>
<div>
<p class="link">
<a href="https://code.visualstudio.com/docs/nodejs/nodejs-debugging" target="_blank" rel="noopener noreferrer">Node debugging in
VS Code</a>
</p>
</div>
</div>
</div>
<div class="column">
<div class="numberCircle">
3
</div>
<div>
<p class="title">Deploy your changes</p>
<p> Commit your changes, <span class="code">git push</span> to redploy, then refresh this page.</p>
<div>
<p class="link">
<a href="https://code.visualstudio.com/docs/editor/versioncontrol" target="_blank" rel="noopener noreferrer">Version
control in VS Code</a>
</p>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="content2">
<div class="column centered empty"></div>
<div class="column centered">
<!-- <div class="numberCircle-Light"></div> -->
<div class="centered">
<a href="https://code.visualstudio.com/tutorials/app-service-extension/getting-started" target="_blank" rel="noopener noreferrer">
<button class="continue-btn" type="button">
CONTINUE WALKTHROUGH >
</button>
</a>
</div>
</div>
<div class="column centered empty"></div>
</div>
</div>
</div>
</body>
</html>

26
util.js Normal file
Просмотреть файл

@ -0,0 +1,26 @@
//@ts-check
const fs = require('fs');
const util = require('util');
const metaDataFileName = `${__dirname}/metadata.json`;
var file = require(metaDataFileName);
const promisifiedReadFile = util.promisify(fs.readFile);
module.exports.loadEnvironmentVariables = async function(updateObject) {
return await fs.readFileSync(`${__dirname}/template.html`, 'utf8')
.replace(
'{ envVars }',
`let env = ` +
JSON.stringify(updateObject)
);
}
module.exports.updateMetadataFile = function(expiryTimestamp, userGuid) {
file.expiryTimestamp = expiryTimestamp;
file.userGuid = userGuid;
fs.writeFileSync(metaDataFileName, JSON.stringify(file));
}
module.exports.readMetadataFile = async function() {
let content = await promisifiedReadFile(metaDataFileName, 'utf8');
return JSON.parse(content);
}