-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(adapter): aws starter adapter #4390
Merged
Merged
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6f74561
feat(adapter): :fire: aws lambda adapter
leifermendez 043fafc
feat(adapter): :fire: aws adapter
leifermendez e46140a
feat(adapter): :fire: aws adapter
leifermendez eaea55e
feat(adapter): :fire: aws adapter
leifermendez 9d65267
feat: :zap: change pnpm lock version
leifermendez 0ec5478
feat: :zap: remove stuff
leifermendez f11054d
feat: :zap: update runtime `18.x` implement single entrypoint
leifermendez a88d5a0
fix: :zap: linter
leifermendez aab9493
fix: :bug: resolve pnpm confilct
leifermendez 245f865
fix: :zap: linter
leifermendez 6725953
Merge branch 'main' into adapter/aws
leifermendez 1594df5
fix: :zap: linter
leifermendez ad8cc6e
feat: :zap: implemente `entry_` in vite plugin
leifermendez 69fe024
fix: :fire: improve stuff
leifermendez File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 @@ | ||
import { nodeServerAdapter } from '@builder.io/qwik-city/adapters/node-server/vite'; | ||
import { extendConfig } from '@builder.io/qwik-city/vite'; | ||
import baseConfig from '../../vite.config'; | ||
|
||
export default extendConfig(baseConfig, () => { | ||
return { | ||
build: { | ||
ssr: true, | ||
rollupOptions: { | ||
input: ['src/entry.aws-lambda.tsx', 'src/entry.ssr.tsx', '@qwik-city-plan'], | ||
}, | ||
}, | ||
plugins: [nodeServerAdapter({ name: 'express' })], | ||
}; | ||
}); |
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,37 @@ | ||
require("source-map-support/register"); | ||
const express = require("express"); | ||
const serverlessExpress = require("@vendia/serverless-express"); | ||
let serverlessExpressInstance; | ||
|
||
/** | ||
* Some async functions | ||
*/ | ||
function asyncTask() { | ||
// console.log(" Connection to database....."); | ||
} | ||
|
||
async function setup(event, context) { | ||
//await asyncTask(); | ||
const { router, notFound, distDir, buildDir } = await import( | ||
"./server/entry.aws-lambda.mjs" | ||
); | ||
const app = express(); | ||
app.use( | ||
`/build`, | ||
express.static(buildDir, { immutable: true, maxAge: "1y" }) | ||
); | ||
app.use(express.static(distDir, { redirect: false })); | ||
app.use(router); | ||
app.use(notFound); | ||
serverlessExpressInstance = serverlessExpress({ app }); | ||
return serverlessExpressInstance(event, context); | ||
} | ||
|
||
function handler(event, context) { | ||
if (serverlessExpressInstance) | ||
return serverlessExpressInstance(event, context); | ||
|
||
return setup(event, context); | ||
} | ||
|
||
exports.qwikApp = 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,23 @@ | ||
{ | ||
"description": "AWS Lambda", | ||
"scripts": { | ||
"build.server": "vite build -c adapters/aws-lambda/vite.config.ts", | ||
"serverless:preview": "serverless offline" | ||
}, | ||
"devDependencies": { | ||
"@vendia/serverless-express": "^4.10.4", | ||
"source-map-support": "^0.5.21", | ||
"serverless-plugin-qwik": "^1.0.5", | ||
"@types/express": "4.17.17", | ||
"express": "4.18.2" | ||
}, | ||
"__qwik__": { | ||
"priority": 30, | ||
"displayName": "Adapter: AWS Lambda", | ||
"docs": [ | ||
"https://qwik.builder.io/qwikcity/adaptors/aws-lambda/", | ||
"https://aws.amazon.com/es/lambda/", | ||
"https://www.serverless.com/cloud/docs/get-started" | ||
] | ||
} | ||
} |
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,21 @@ | ||
service: aws | ||
frameworkVersion: '3' | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs16.x | ||
leifermendez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
functions: | ||
hello: | ||
handler: handler.qwikApp | ||
events: | ||
- httpApi: '*' | ||
|
||
package: | ||
excludeDevDependencies: false | ||
|
||
plugins: | ||
- serverless-offline | ||
- serverless-plugin-qwik | ||
- serverless-plugin-common-excludes | ||
- serverless-plugin-include-dependencies |
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,12 @@ | ||
import { createQwikCity } from '@builder.io/qwik-city/middleware/node'; | ||
import qwikCityPlan from '@qwik-city-plan'; | ||
import { manifest } from '@qwik-client-manifest'; | ||
import { fileURLToPath } from 'node:url'; | ||
import { join } from 'node:path'; | ||
|
||
import render from './entry.ssr'; | ||
|
||
export const distDir = join(fileURLToPath(import.meta.url), '..', '..', 'dist'); | ||
export const buildDir = join(distDir, 'build'); | ||
|
||
export const { router, notFound } = createQwikCity({ render, qwikCityPlan, manifest }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo a deploy and remove cmd would be nice as well 👼 but would require a local aws profile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not add the serverless:deploy because of that point is necessary AWS profile. I think maybe explain on the docs