Here's this example as a GET request: https://api.saasify.sh/1/call/transitive-bullshit/text-to-ascii-art@09087438/?input=https://octodex.github.com/images/original.png&ops[0][op]=jpeg.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.0.2", | |
| "info": { | |
| "title": "Fast API", | |
| "version": "0.1.0" | |
| }, | |
| "paths": { | |
| "/stylecloud": { | |
| "post": { | |
| "responses": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GRPC_TRACE=all GRPC_VERBOSITY=DEBUG node benchmark-multiple-gets.js | |
| D0326 16:48:14.918318000 4490681792 dns_resolver.cc:294] Using native dns resolver | |
| I0326 16:48:14.918674000 4490681792 timer_manager.cc:88] Spawn timer thread | |
| I0326 16:48:14.918704000 4490681792 init.cc:164] grpc_init(void) | |
| I0326 16:48:14.918728000 123145542873088 timer_manager.cc:250] timers not checked: expect another thread to | |
| I0326 16:48:14.918742000 123145542873088 timer_manager.cc:197] sleep until kicked | |
| I0326 16:48:14.919055000 4490681792 completion_queue.cc:504] grpc_completion_queue_create_internal(completion_type=0, polling_type=0) | |
| using gRPC via @google-cloud/firestore | |
| I0326 16:48:15.248755000 4490681792 ssl_credentials.cc:130] grpc_ssl_credentials_create(pem_root_certs=(null), pem_key_cert_pair=0x0, verify_options=0x7ffeefbfe520, reserved=0x0) | |
| I0326 16:48:15.256503000 4490681792 plugin_credentials.cc:250] grpc_metadata_credentials_creat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const axios = require('axios'); | |
| async function main () { | |
| const getImg = (url) => { | |
| return axios.get(url, { responseType: 'arraybuffer' }); | |
| } | |
| const url = 'https://octodex.github.com/images/original.png'; | |
| const original = await getImg(url); | |
| console.log('original', { status: original.status, size: original.data.length }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const axios = require('axios'); | |
| async function main () { | |
| const url = 'https://octodex.github.com/images/original.png'; | |
| const optimized = await axios.post('https://ssfy.sh/dev/imagemin/optimizeImageUrl', { url }, { | |
| responseType: 'arraybuffer' | |
| }); | |
| console.log('optimized', { status: optimized.status, size: optimized.data.length }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const crypto = require('crypto') | |
| const hash = (d) => { | |
| const buffer = Buffer.isBuffer(d) ? d : Buffer.from(d.toString()) | |
| return crypto.createHash('sha256').update(buffer).digest('hex') | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const hasha = require('hasha') | |
| const hash = (input) => hasha(input, { algorithm: 'sha256' }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const pick = require('lodash.pick') | |
| const stableStringify = require('fast-json-stable-stringify') | |
| const data = pick(myData, ['keyFoo', 'keyBar']) | |
| const fingerprint = hash(stableStringify(data)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style> | |
| .gist { | |
| width: 100%; | |
| max-width: 680px; | |
| } | |
| .gist-file { | |
| margin-bottom: 0 !important; | |
| } | |
| .gist + figcaption { | |
| margin-top: 1em; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const isProd = (process.env.NODE_ENV === 'production') | |
| /** | |
| * Small utility for storing both live and test stripe IDs in a mongoose schema, | |
| * but only publicly surfacing the active ID depending on the current | |
| * environment. | |
| */ | |
| module.exports = (id, type = String, opts = { }) => { | |
| const testId = `_${id}Test` | |
| const liveId = `_${id}Live` |