mirror of
https://github.com/Lissy93/web-check.git
synced 2025-06-01 07:55:44 +02:00
Adds compatibility for deploying direct to AWS lambda
This commit is contained in:
parent
e1d9b13045
commit
18faeb631b
51
api/_common/aws-webpack.config.js
Normal file
51
api/_common/aws-webpack.config.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const nodeExternals = require('webpack-node-externals');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
target: 'node',
|
||||||
|
mode: 'production',
|
||||||
|
entry: {
|
||||||
|
'carbon': './api/carbon.js',
|
||||||
|
'cookies': './api/cookies.js',
|
||||||
|
'dns-server': './api/dns-server.js',
|
||||||
|
'dns': './api/dns.js',
|
||||||
|
'dnssec': './api/dnssec.js',
|
||||||
|
'features': './api/features.js',
|
||||||
|
'get-ip': './api/get-ip.js',
|
||||||
|
'headers': './api/headers.js',
|
||||||
|
'hsts': './api/hsts.js',
|
||||||
|
'linked-pages': './api/linked-pages.js',
|
||||||
|
'mail-config': './api/mail-config.js',
|
||||||
|
'ports': './api/ports.js',
|
||||||
|
'quality': './api/quality.js',
|
||||||
|
'redirects': './api/redirects.js',
|
||||||
|
'robots-txt': './api/robots-txt.js',
|
||||||
|
'screenshot': './api/screenshot.js',
|
||||||
|
'security-txt': './api/security-txt.js',
|
||||||
|
'sitemap': './api/sitemap.js',
|
||||||
|
'social-tags': './api/social-tags.js',
|
||||||
|
'ssl': './api/ssl.js',
|
||||||
|
'status': './api/status.js',
|
||||||
|
'tech-stack': './api/tech-stack.js',
|
||||||
|
'trace-route': './api/trace-route.js',
|
||||||
|
'txt-records': './api/txt-records.js',
|
||||||
|
'whois': './api/whois.js',
|
||||||
|
},
|
||||||
|
externals: [nodeExternals()],
|
||||||
|
output: {
|
||||||
|
filename: '[name].js',
|
||||||
|
path: path.resolve(__dirname, '.webpack'),
|
||||||
|
libraryTarget: 'commonjs2'
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
use: {
|
||||||
|
loader: 'babel-loader'
|
||||||
|
},
|
||||||
|
exclude: /node_modules/,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
16
package.json
16
package.json
@ -17,7 +17,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "netlify dev",
|
"dev": "netlify dev",
|
||||||
"serve": "netlify serve --offline",
|
"serve": "netlify serve --offline",
|
||||||
"start": "react-scripts start",
|
"start": "node server",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
@ -39,6 +39,7 @@
|
|||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"cheerio": "^1.0.0-rc.12",
|
"cheerio": "^1.0.0-rc.12",
|
||||||
"chrome-aws-lambda": "^10.1.0",
|
"chrome-aws-lambda": "^10.1.0",
|
||||||
|
"chromium": "^3.0.3",
|
||||||
"connect-history-api-fallback": "^2.0.0",
|
"connect-history-api-fallback": "^2.0.0",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"flatted": "^3.2.7",
|
"flatted": "^3.2.7",
|
||||||
@ -49,7 +50,7 @@
|
|||||||
"perf_hooks": "^0.0.1",
|
"perf_hooks": "^0.0.1",
|
||||||
"psl": "^1.9.0",
|
"psl": "^1.9.0",
|
||||||
"puppeteer": "^20.9.0",
|
"puppeteer": "^20.9.0",
|
||||||
"puppeteer-core": "^20.9.0",
|
"puppeteer-core": "^21.0.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-masonry-css": "^1.0.16",
|
"react-masonry-css": "^1.0.16",
|
||||||
@ -60,9 +61,9 @@
|
|||||||
"styled-components": "^6.0.5",
|
"styled-components": "^6.0.5",
|
||||||
"traceroute": "^1.0.0",
|
"traceroute": "^1.0.0",
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
"wappalyzer": "^6.10.63",
|
"wappalyzer": "^6.10.65",
|
||||||
"web-vitals": "^3.4.0",
|
"web-vitals": "^3.4.0",
|
||||||
"xml2js": "^0.6.0"
|
"xml2js": "^0.6.2"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
@ -85,5 +86,12 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"outDir": "./dist"
|
"outDir": "./dist"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"serverless-domain-manager": "^7.1.1",
|
||||||
|
"serverless-offline": "^12.0.4",
|
||||||
|
"serverless-webpack": "^5.13.0",
|
||||||
|
"webpack": "^5.88.2",
|
||||||
|
"webpack-node-externals": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
179
serverless.yml
Normal file
179
serverless.yml
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
service: web-check-api
|
||||||
|
|
||||||
|
provider:
|
||||||
|
name: aws
|
||||||
|
runtime: nodejs14.x
|
||||||
|
region: us-east-1
|
||||||
|
|
||||||
|
functions:
|
||||||
|
dnssec:
|
||||||
|
handler: api/dnssec.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/dnssec
|
||||||
|
method: get
|
||||||
|
linkedPages:
|
||||||
|
handler: api/linked-pages.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/linked-pages
|
||||||
|
method: get
|
||||||
|
robotsTxt:
|
||||||
|
handler: api/robots-txt.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/robots-txt
|
||||||
|
method: get
|
||||||
|
ssl:
|
||||||
|
handler: api/ssl.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/ssl
|
||||||
|
method: get
|
||||||
|
whois:
|
||||||
|
handler: api/whois.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/whois
|
||||||
|
method: get
|
||||||
|
carbon:
|
||||||
|
handler: api/carbon.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/carbon
|
||||||
|
method: get
|
||||||
|
features:
|
||||||
|
handler: api/features.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/features
|
||||||
|
method: get
|
||||||
|
mailConfig:
|
||||||
|
handler: api/mail-config.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/mail-config
|
||||||
|
method: get
|
||||||
|
screenshot:
|
||||||
|
handler: api/screenshot.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/screenshot
|
||||||
|
method: get
|
||||||
|
status:
|
||||||
|
handler: api/status.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/status
|
||||||
|
method: get
|
||||||
|
cookies:
|
||||||
|
handler: api/cookies.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/cookies
|
||||||
|
method: get
|
||||||
|
getIp:
|
||||||
|
handler: api/get-ip.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/get-ip
|
||||||
|
method: get
|
||||||
|
ports:
|
||||||
|
handler: api/ports.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/ports
|
||||||
|
method: get
|
||||||
|
securityTxt:
|
||||||
|
handler: api/security-txt.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/security-txt
|
||||||
|
method: get
|
||||||
|
techStack:
|
||||||
|
handler: api/tech-stack.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/tech-stack
|
||||||
|
method: get
|
||||||
|
dnsServer:
|
||||||
|
handler: api/dns-server.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/dns-server
|
||||||
|
method: get
|
||||||
|
headers:
|
||||||
|
handler: api/headers.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/headers
|
||||||
|
method: get
|
||||||
|
quality:
|
||||||
|
handler: api/quality.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/quality
|
||||||
|
method: get
|
||||||
|
sitemap:
|
||||||
|
handler: api/sitemap.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/sitemap
|
||||||
|
method: get
|
||||||
|
traceRoute:
|
||||||
|
handler: api/trace-route.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/trace-route
|
||||||
|
method: get
|
||||||
|
dns:
|
||||||
|
handler: api/dns.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/dns
|
||||||
|
method: get
|
||||||
|
hsts:
|
||||||
|
handler: api/hsts.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/hsts
|
||||||
|
method: get
|
||||||
|
redirects:
|
||||||
|
handler: api/redirects.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/redirects
|
||||||
|
method: get
|
||||||
|
socialTags:
|
||||||
|
handler: api/social-tags.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/social-tags
|
||||||
|
method: get
|
||||||
|
txtRecords:
|
||||||
|
handler: api/txt-records.handler
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: api/txt-records
|
||||||
|
method: get
|
||||||
|
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
# - serverless-webpack
|
||||||
|
- serverless-domain-manager
|
||||||
|
- serverless-offline
|
||||||
|
|
||||||
|
custom:
|
||||||
|
webpack:
|
||||||
|
webpackConfig: 'api/_common/aws-webpack.config.js'
|
||||||
|
includeModules: true
|
||||||
|
|
||||||
|
customDomain:
|
||||||
|
domainName: example.com
|
||||||
|
basePath: 'api'
|
||||||
|
stage: ${self:provider.stage}
|
||||||
|
createRoute53Record: true
|
||||||
|
|
||||||
|
serverless-offline:
|
||||||
|
prefix: ''
|
||||||
|
httpPort: 3000
|
Loading…
x
Reference in New Issue
Block a user