The nodejs CLI tool of sharklet API.
Install it and run your CLI commands.
$ npm install @wangsu_serverless/sharklet-cli -g
Node.js >= 10.x
You must know your account, and the cloud product's endpoint
and apiVersion
.
The CLI style tools:
$ mkdir yourProject & cd yourProject
$ 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 });
}
$ sharklet-cli config
$ sharklet-cli build
$ 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
$ sharklet-cli publish
$ curl -v 'https://yourdomain.com/yourpath/'
$ sharklet-cli publish -s
The MIT License