@nano-edge/cli
TypeScript icon, indicating that this package has built-in type declarations

1.6.2 • Public • Published

NanoEdge

Disclaimer: do not deploy secrets that are really secret! these secrets might be exploitable!

All you need to do to deploy your app is to run the following command:

npx @nano-edge/cli deploy

Advanced usage:

Do not forget to set the NANO_EDGE_AUTH_TOKEN env var, which is required by the cli.

export NANO_EDGE_AUTH_TOKEN=xxx npx @nano-edge/cli deploy --env.MY_SECRET=$SOME_SECRET

To customize cli options, you can create a file nano-edge.config.json:

{
  "env": {
    "SOME_ENV_VAR": "SOME_VALUE"
  }
}

Build output API example:

  • functions/api.js
  • functions/env.json
  • static/index.html
  • static/main.js

The signature of a function is export default async (request: Request) => Promise<Response>.
A function can access env vars by using process.env.
env.json will be generated by the cli if nano-edge.config.ts contains env vars. The file is overwritten if it already did exist before.

How inbound traffic would be handled by which resource from the build output:

  • /api -> functions/api.js (function exec)
  • /api/some/sub/path -> functions/api.js (function exec)
  • /index.html -> static/index.html (served static)
  • /main.js -> static/main.js (served static)
  • /some/random/path -> static/index.html (served static)
  • Edge-case (precedence): If a static file exists with same name as a function, the static file is not served. Instead, the function is executed.

Dependents (0)

Package Sidebar

Install

npm i @nano-edge/cli

Weekly Downloads

3

Version

1.6.2

License

MIT

Unpacked Size

15.8 kB

Total Files

8

Last publish

Collaborators

  • adamsondavid