https://github.com/bernas670/greenstamp-server
https://github.com/bernas670/greenstamp-server
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bernas670/greenstamp-server
- Owner: bernas670
- Created: 2022-11-23T12:18:11.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-05-18T13:58:09.000Z (about 2 years ago)
- Last Synced: 2025-02-17T23:36:07.154Z (4 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GreenStamp API
This API allows users to upload files to the server. The API is packaged as a Docker container for easy deployment.## Getting Started
These instructions will get you the API up and running in a Docker container.### Prerequisites
- Docker 19.x or later### Running the API in a Docker container
1. Build docker image from the `Dockerfile`:
```
docker build -t greenstamp-server .
```
2. Run the docker container and map the ports:
```
docker run -p :8080 greenstamp-server
```This will start the API in a Docker container and expose it on port `` on the host machine.
## Usage
To upload a file, send a `POST` request to the `/upload` route with the file data in the request body. The file should be sent as a `form-data` request with the key `file`.
Here is an example of how to upload a file using cURL, if you use port `8080`:
```
curl -X POST \
http://localhost:8080/upload \
-H 'Content-Type: multipart/form-data' \
-F 'file=@/path/to/file.pdf'
```
The API will save the file to the `uploads/` directory on the server, and return a `200 OK` response with the message `File saved!`.## Built With
- [Express.js](https://expressjs.com/) - The web framework used
- [multer](https://www.npmjs.com/package/multer) - The middleware used for file uploads