https://github.com/yourakshaw/upload-service
A simple ⬆️ upload service built using Node.js, Express.js, and JavaScript using my template microservice-template-nodejs-js.
https://github.com/yourakshaw/upload-service
javascript mongo nodejs upload
Last synced: 3 months ago
JSON representation
A simple ⬆️ upload service built using Node.js, Express.js, and JavaScript using my template microservice-template-nodejs-js.
- Host: GitHub
- URL: https://github.com/yourakshaw/upload-service
- Owner: YourAKShaw
- License: mit
- Created: 2024-07-15T12:47:14.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-07-18T09:55:53.000Z (11 months ago)
- Last Synced: 2025-03-04T08:11:48.699Z (3 months ago)
- Topics: javascript, mongo, nodejs, upload
- Language: JavaScript
- Homepage:
- Size: 112 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ⬆️ Upload Service
![]()
A simple ⬆️ upload service built using Node.js, Express.js, and JavaScript using my template [microservice-template-nodejs-js](https://github.com/YourAKShaw/microservice-template-nodejs-js).
## Usage && Notes
### Sample
- Contains [Sample](./src/sample/) module from [microservice-template-nodejs-js](https://github.com/YourAKShaw/microservice-template-nodejs-js).
- Since the [Sample](./src/sample/) module makes use of the MongoClient from [mongodb](https://www.mongodb.com/resources/languages/mongodb-with-nodejs), it requires the MONGODB_URI in the .env, otherwise the server won't start. One way to bypass this, in case you don't need to checkout the Sample module and use only the Upload module, is to commenting the following piece of code from [sample.model.js](./src/sample/sample.model.js).```js
const sampleCollection = await (async () => {
const db = await getDb();
return db.collection('samples');
})(); // Immediately Invoked Function Expression (IIFE) for collection creation
```### Upload
Two types of upload supported:
1. File Attachment
2. File URL#### File Attachment
**POST** _/api/upload_
##### form-data
| Key | Value |
| ---------------- | ------------ |
| fieldName (File) | [attachment] |#### File URL
**POST** _/api/upload_
##### raw
```json
{
"fileUrl": ""
}
```## Get to know me 😉
⚪ Author: [Ayush Kumar Shaw](https://www.github.com/YourAKShaw)
⚪ Website: [yourakshaw.com](https://www.yourakshaw.com)
⚪ X: [@YourAKShaw](https://www.x.com/YourAKShaw)
## License
This template is [MIT licensed](./LICENSE).