Giter Club home page Giter Club logo

express-image-upload's Introduction

ExpressJS image upload and view with mysql

table of contents

description

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.

dependencies

  • express
  • multer
  • cors
  • dotenv
  • nodemon
  • morgan
  • mysql
  • body-parser
  • express-fileupload
  • express-validator

dev dependencies

  • eslint
  • eslint-config-airbnb-base
  • eslint-plugin-import

steps to run

  1. Clone the repository.
  2. Run npm install
  3. create a .env file in the root directory.
  4. 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
  1. Run npm start or nodemon index.js to start the server.

usage

  1. 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 be image. You can also add a description to the image by adding a key called description 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}
  1. You can also make a get request to http://localhost:3000/v1/files?id to get all the images in the storage folder.

author

license

This project is licensed under the MIT License - see the LICENSE.md file for details.

acknowledgements

version

1.0.0

Thanks for Visiting

Please ๐ŸŒŸ this repository! It really helps others to find this!!


Created with ๐Ÿงก by Supun Nanayakkara

express-image-upload's People

Contributors

supuna97 avatar imgbotapp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.