Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Conversation

@danielcondemarin
Copy link
Contributor

@danielcondemarin danielcondemarin commented Mar 1, 2019

Motivation

Currently, to deploy a next page a function needs to be specified in the serverless.yml file. For example:

functions:
  home-page:
    handler: build/serverless/pages/home.render
    events:
      - http:
          path: home
          method: get

For a few pages this is fine, but applications with 10 or more pages it becomes very repetitive and difficult to maintain.

Proposed solution

Default plugin behaviour

The plugin will automatically detect any pages by looking at the next build directory. For example, let say we have two pages:

.next/serverless/pages/home.js
.next/serverless/pages/about.js

Instead of declaring the functions for these pages in the serverless.yml file, the plugin will automatically include them in the deployment.

The following configuration will be used for each page:

Using homePage as an example:

homePage:
    handler: /path/to/next/build/serverless/pages/home.render
    events:
      - http:
          path: /home
          method: get

Overriding defaults

The user can override a page function configuration by declaring it in the serverless.yml file. The plugin will merge the user provided configuration into the defaults above. Note the function name specified has to match {name}Page.

@danielcondemarin danielcondemarin changed the title docs: initial commit Dynamically deployed next pages Mar 1, 2019
@danielcondemarin danielcondemarin changed the title Dynamically deployed next pages Dynamically built and deployed next pages Mar 1, 2019
@danielcondemarin danielcondemarin added the enhancement New feature or request label Mar 1, 2019
@danielcondemarin danielcondemarin changed the title Dynamically built and deployed next pages Dynamically built and deployed next pages - WIP Mar 1, 2019
@danielcondemarin danielcondemarin changed the title Dynamically built and deployed next pages - WIP Dynamically built and deployed next pages Mar 1, 2019
@danielcondemarin
Copy link
Contributor Author

Closed in favour of a Draft PR

mike-suggitt added a commit to mike-suggitt/serverless-next.js that referenced this pull request Nov 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants