1.0.9 • Published 4 years ago
@wangsu_serverless/sharklet-cli v1.0.9
sharklet-cli
The nodejs CLI tool of sharklet API.
Installation
Install it and run your CLI commands.
$ npm install @wangsu_serverless/sharklet-cli -gPrerequisite
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 yourProject2. 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 config4. Build code and you can test with gray env .
$ sharklet-cli build5. 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 -s6. Publish code only when you are ready online after detailed tests.
$ sharklet-cli publish7. Test your code online and check your service ok.
$ curl -v 'https://yourdomain.com/yourpath/'$ sharklet-cli publish -sLicense
The MIT License