An open API service indexing awesome lists of open source software.

https://github.com/cncf/svg-autocrop-serverless

πŸš—πŸŒ½πŸ”³πŸ’β€β™€οΈπŸ™…β€β™€οΈπŸ’β€β™‚οΈπŸ™…β€β™‚οΈServerless infrastructure for SVG Autocrop
https://github.com/cncf/svg-autocrop-serverless

Last synced: 10 months ago
JSON representation

πŸš—πŸŒ½πŸ”³πŸ’β€β™€οΈπŸ™…β€β™€οΈπŸ’β€β™‚οΈπŸ™…β€β™‚οΈServerless infrastructure for SVG Autocrop

Awesome Lists containing this project

README

          

What is this:
A repo for a serverless (gcloud functions) api of svg-autocrop.

Install: npm install, at this moment a nodejs v10 is used

Debug locally: functions-framework --target=autocrop1

where autocrop1 is a function name from an index.js

Deploy: gcloud functions deploy --runtime=nodejs10 --region=us-central1 --trigger-http autocrop1

# Example API Usage:

```
const baseUrl = 'https://us-central1-cncf-svg-autocrop.cloudfunctions.net/autocrop';
const rp = require('request-promise');
const input = require('fs').readFileSync(`node_modules/svg-autocrop/fixtures/f5.input.svg`, 'utf-8');
const response = await rp({
method: 'POST',
body: {"svg": input, title: "new title"},
uri: baseUrl,
json: true
});
console.info(response);
```
output: `{ success : true, result: '