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
- Host: GitHub
- URL: https://github.com/cncf/svg-autocrop-serverless
- Owner: cncf
- License: mit
- Created: 2019-12-23T18:22:12.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-15T21:18:26.000Z (almost 3 years ago)
- Last Synced: 2024-12-29T18:30:02.810Z (over 1 year ago)
- Language: HTML
- Homepage: https://autocrop.cncf.io
- Size: 1.17 MB
- Stars: 8
- Watchers: 4
- Forks: 7
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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: '