1.0.9 • Published 3 years ago

@wangsu_serverless/sharklet-cli v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

sharklet-cli

The nodejs CLI tool of sharklet API.

Installation

Install it and run your CLI commands.

$ npm install @wangsu_serverless/sharklet-cli -g

Prerequisite

Node.js >= 10.x

Notes

You must know your account, and the cloud product's endpoint and apiVersion.

Usage

The CLI style tools:

1. Prepare an empty directory.

$ mkdir yourProject & cd yourProject

2. Initialize and coding with edge.js as example codes.

$ sharklet-cli init
/**
 * Add the necessary event listener
 * @param {Event} fetch event, {Function} async function
 */
addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request));
})

/**
 * Make a response to client
 * @param {Request} request
 */
async function handleRequest(request) {
  return new Response('Hello World!', { status: 200 });
}

3. Config with your wangsu access, fill in the prompts here.

$ sharklet-cli config

4. Build code and you can test with gray env .

$ sharklet-cli build

5. Test your code now, you can also show your codes and related config.

$ curl -v 'http://yourdomain.com/yourpath/' -x 59.61.78.233:80
$ curl --resolve yourdomain.com:443:59.61.78.233 'https://yourdomain.com/yourpath/' -v
$ sharklet-cli build -s

6. Publish code only when you are ready online after detailed tests.

$ sharklet-cli publish

7. Test your code online and check your service ok.

$ curl -v 'https://yourdomain.com/yourpath/'
$ sharklet-cli publish -s

License

The MIT License