- description
- dependencies
- dev dependencies
- steps to run
- usage
- author
- license
- acknowledgements
- version
This is a simple express server that allows you to upload images and view them. The images are stored in the storage folder and the image data is stored in a mysql database. The database is created using the ejs_crud.sql
file. The server is hosted on port 3000. The server is also configured to use eslint with the airbnb style guide.
- express
- multer
- cors
- dotenv
- nodemon
- morgan
- mysql
- body-parser
- express-fileupload
- express-validator
- eslint
- eslint-config-airbnb-base
- eslint-plugin-import
- Clone the repository.
- Run
npm install
- create a .env file in the root directory.
- Add the following to the .env file.
PORT=3000
DB_HOST=localhost
DB_USERNAME=root
DB_PASSWORD=
DB_NAME=ejs_crud
DB_PORT=3306
DB_CONNECTION_LIMIT=10
- Run
npm start
ornodemon index.js
to start the server.
- Open your postman and make a post request to
http://localhost:3000/v1/files/upload
with the image file attached to the body of the request. The key should beimage
. You can also add a description to the image by adding a key calleddescription
to the body of the request. The response will be a json object with the filename and the description of the image.
- json - { "filename": "image.jpg", description: "image description}
- You can also make a get request to
http://localhost:3000/v1/files?id
to get all the images in the storage folder.
This project is licensed under the MIT License - see the LICENSE.md file for details.
1.0.0
Created with 🧡 by Supun Nanayakkara