-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yangbo08
committed
Mar 2, 2023
1 parent
7a346b1
commit a280050
Showing
125 changed files
with
22,189 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TENCENT_SECRET_ID=123 | ||
TENCENT_SECRET_KEY=123 | ||
|
||
# please change <appid> to your real appid | ||
STATIC_URL=https://nuxtjs-demo-<appid>.cos.ap-guangzhou.myqcloud.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Node template | ||
# Logs | ||
/logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
sw.* | ||
|
||
# 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 (http://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 | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# Nuxt generate | ||
dist | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless | ||
|
||
# IDE / Editor | ||
.idea | ||
|
||
# Service worker | ||
sw.* | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
# Vim swap files | ||
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
# content | ||
blog content | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"platformStage":"prod","accessKey":"AKIDc50Ex3N3c5kTl113gy6sOWiDD7ff0XyY%3AzJ8EHzUEU61K64PRtl57cCAjTcl6K1iX%3A41def7c179ac65a2fe5d8a82d344956c52bc3dcd20001","devMode":false,"orgName":"1256345838","stageName":"prod","appName":"yangboblog","instanceName":"nuxtjs-lOhsCPjJT","componentName":"nuxtjs","componentVersion":"1.0.8","srcHandler":"./_shims/handler.handler"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
try { | ||
require('tencent-component-monitor') | ||
} catch (e) { | ||
console.log(e) | ||
} | ||
const fs = require('fs') | ||
const path = require('path') | ||
const { createServer, proxy } = require('tencent-serverless-http') | ||
|
||
let app | ||
let server | ||
|
||
module.exports.handler = async (event, context) => { | ||
const userSls = path.join(__dirname, '..', process.env.SLS_ENTRY_FILE) | ||
if (fs.existsSync(userSls)) { | ||
// eslint-disable-next-line | ||
console.log(`Using user custom entry file ${process.env.SLS_ENTRY_FILE}`) | ||
app = await require(userSls)(true) | ||
} else { | ||
app = await require('./sls')(false) | ||
} | ||
|
||
// attach event and context to request | ||
try { | ||
app.request.__SLS_EVENT__ = event | ||
app.request.__SLS_CONTEXT__ = context | ||
} catch (e) { | ||
// no op | ||
} | ||
|
||
// provide sls intialize hooks | ||
if (app.slsInitialize && typeof app.slsInitialize === 'function') { | ||
await app.slsInitialize() | ||
} | ||
|
||
if (!server) { | ||
server = createServer( | ||
app.callback && typeof app.callback === 'function' ? app.callback() : app, | ||
null, | ||
app.binaryTypes || [] | ||
) | ||
} | ||
|
||
context.callbackWaitsForEmptyEventLoop = app.callbackWaitsForEmptyEventLoop === true | ||
|
||
const result = await proxy(server, event, context, 'PROMISE') | ||
return result.promise | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"dependencies": { | ||
"express": "^4.17.1", | ||
"tencent-component-monitor": "^1.1.0", | ||
"tencent-serverless-http": "^1.3.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const express = require('express') | ||
const { loadNuxt } = require('nuxt') | ||
|
||
async function createServer() { | ||
// not report route for custom monitor | ||
const noReportRoutes = ['/_nuxt', '/static', '/favicon.ico'] | ||
|
||
const server = express() | ||
const nuxt = await loadNuxt('start') | ||
|
||
server.all('*', (req, res, next) => { | ||
noReportRoutes.forEach((route) => { | ||
if (req.path.indexOf(route) === 0) { | ||
req.__SLS_NO_REPORT__ = true | ||
} | ||
}) | ||
return nuxt.render(req, res, next) | ||
}) | ||
|
||
// define binary type for response | ||
// if includes, will return base64 encoded, very useful for images | ||
server.binaryTypes = ['*/*'] | ||
|
||
// 返回 server | ||
return server | ||
} | ||
|
||
module.exports = createServer |
Oops, something went wrong.