This is a Node.js server using Express and PostgreSQL to handle image uploads. It provides endpoints for uploading and retrieving images.
- Clone the repository:
git clone https://github.com/your-username/image-upload-server.git
- Install dependencies:
npm install
- Create a
.env
file with the following environment variables:DATABASE_URL
: the connection string for the PostgreSQL databasePORT
: the port number for the server to listen on (default is 3000)
- Start the server:
npm start
Returns a welcome message.
Uploads an image. Expects a multipart/form-data
request with a field named image
.
Retrieves an image by ID. Returns the image as a binary stream.
- express: web framework for Node.js
- pg: PostgreSQL client for Node.js
- multer: middleware for handling
multipart/form-data
requests
This project is licensed under the MIT License. See the LICENSE file for details.