@@ -11,6 +11,33 @@ cd MegaCDN
1111npm install
1212```
1313
14+ ## Deployments
15+
16+ #### Deploy To Heroku
17+ 1 . * If You Don't Have a Heroku Account, [ Create An Account] ( https://signup.heroku.com ) .*
18+ 2 . * Now Deploy To Heroku.* <br >
19+ [ ![ Heroku] ( https://img.shields.io/badge/Heroku-000000?style=for-the-badge&logo=heroku&logoColor=white )] ( https://heroku.com/deploy?template=https://github.com/IRON-M4N/MegaCDN )
20+
21+ #### Deploy on Vercel
22+ 1 . * [ Create Verce Account] ( https://vercel.com/signup ) If You Don't Have.*
23+ 2 . * Deploy on Vercel.* <br >
24+ [ ![ Vercel] ( https://img.shields.io/badge/Vercel-000000?style=for-the-badge&logo=vercel&logoColor=white )] ( https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FIRON-M4N%2FMegaCDN&env=MEGA_ACCOUNT,PORT&envDescription=provide%20multiple%20accounts%20in%20this%20format%20email%3Apass%3Bemail%3Apass%0Afor%20port%20use%203000%20or%20any )
25+
26+ #### Deploy To Railway
27+ 1 . * If You Don't Have Railway Account, [ Create First] ( https://railway.com ) .*
28+ 2 . * Now Deploy The Repo.* <br >
29+ [ ![ Railway] ( https://img.shields.io/badge/Railway-000000?style=for-the-badge&logo=railway&logoColor=white )] ( https://railway.com/new )
30+
31+ #### Deploy on Render
32+ 1 . * [ Create Render Account] ( https://dashboard.render.com/register ) If You Don't Have Any.*
33+ 2 . * Deploy Now.* <br >
34+ [ ![ Render] ( https://img.shields.io/badge/Render-000000?style=for-the-badge&logo=render&logoColor=white )] ( https://render.com/deploy?repo=https://github.com/IRON-M4N/MegaCDN )
35+
36+ #### Deploy on Koyeb
37+ 1 . * [ Create Account] ( https://app.koyeb.com/auth/signup ) If You Don't Have.*
38+ 2 . * Now Deploy.* <br >
39+ [ ![ Koyeb] ( https://img.shields.io/badge/Koyeb-000000?style=for-the-badge&logo=koyeb&logoColor=white )] ( https://app.koyeb.com/deploy?type=git&repository=github.com/IRON-M4N/MegaCDN&name=MegaCDN&builder=buildpack&env[MEGA_ACCOUNT]=email:pass&env[PORT]=3000&env[TEMP]=memory )
40+
1441## Configuration
1542
1643Modify ` config.js ` or use environment variables. Example ` .env ` file:
@@ -32,21 +59,74 @@ npm stop
3259npm restart
3360```
3461
35- ## ** Uploading Files**
62+ ## Uploading Files
3663
37- Send a ` POST ` request to ` /upload ` with a multipart form containing a file.
64+ Send a POST request to /upload with a multipart form containing a file.
3865
39- #### ** Single Mode (Default)**
40- Uploads the file using the default (first) account.
41- ``` sh
42- curl -X POST -F
" [email protected] " -F
" mode=single" http://yourdomain.com/upload
43- ```
66+ <details >
67+ <summary >Curl - Single Mode</summary >
4468
45- #### ** Dual Mode (Specify Account)**
46- Uploads the file to a specific account by providing an email.
47- ``` sh
48- curl -X POST -F
" [email protected] " -F
" mode=dual" -F
" [email protected] " http://yourdomain.com/upload
49- ```
69+ ``` sh
70+ curl -X POST -F
" [email protected] " -F
" mode=single" http://yourdomain.com/upload
71+ ```
72+ </details >
73+
74+ <details >
75+ <summary >Curl - Dual Mode</summary >
76+
77+ ``` sh
78+ curl -X POST -F
" [email protected] " -F
" mode=dual" -F
" [email protected] " http://yourdomain.com/upload
79+ ```
80+ </details >
81+
82+ <details >
83+ <summary >Node.js - Single Mode</summary >
84+
85+ ``` js
86+ const fs = require (" fs" );
87+ const axios = require (" axios" );
88+ const FormData = require (" form-data" );
89+
90+ async function uploadSingle () {
91+ const form = new FormData ();
92+ form .append (" file" , fs .createReadStream (" image.jpg" ));
93+ form .append (" mode" , " single" );
94+
95+ const res = await axios .post (" http://yourdomain.com/upload" , form, {
96+ headers: form .getHeaders (),
97+ });
98+
99+ console .log (res .data );
100+ }
101+
102+ uploadSingle ();
103+ ```
104+ </details >
105+
106+ <details >
107+ <summary >Node.js - Dual Mode</summary >
108+
109+ ``` js
110+ const fs = require (" fs" );
111+ const axios = require (" axios" );
112+ const FormData = require (" form-data" );
113+
114+ async function uploadDual () {
115+ const form = new FormData ();
116+ form .append (" file" , fs .createReadStream (" image.jpg" ));
117+ form .append (" mode" , " dual" );
118+ form .
append (
" email" ,
" [email protected] " );
119+
120+ const res = await axios .post (" http://yourdomain.com/upload" , form, {
121+ headers: form .getHeaders (),
122+ });
123+
124+ console .log (res .data );
125+ }
126+
127+ uploadDual ();
128+ ```
129+ </details >
50130
51131### ** Parameters Explained:**
52132| Parameter | Description |
0 commit comments