eashish93 / imgsquash
- четверг, 30 мая 2019 г. в 00:16:14
JavaScript
Simple image compression full website code written in node, react and next.js framework. Easy to deploy as a microservice.
Image compression full stack website code. Contains both api service and frontend written in node, react and next.js framework.
gcloud command line tool (download here) or set GOOGLE_APPLICATION_CREDENTIALS env variable with the service account file.
.env file in the root of the folder with the following variables. See dotenv on how to add env variables.
1 (optional).your-google-cloud-bucket-name[YOUR-API-URL]/1/dlnpm install to install all node modules for api.npm run dev to start the dev server on 3000 port.npm start for productionnpm install to install all node modules for frontend.npm run dev will start the webpack server on 3001 port.npm run build and npm start to build and use the code in production.Following programs are used for optimization
Current file size upload limit is 10MB.
API Routes. [POST]
/image: upload image(s) via file, URL, base64 or Binary.
file or base64 or binary.Boolean (default: false)/url: Compression direct image url.
/zip: Accepts list of files object as an array with (id, size and name) and send the zipped result.
[GET]
- /dl/:id: Generate download url of compressed image. Accept optional query name.
MIT