DEV Community

Miracle Anyanwu
Miracle Anyanwu

Posted on

Building a file sharing app with Node.js, Vue.js, Cloudinary, and MySQL - Part 2

In this tutorial, we will be creating an application that lets an individual upload an image. After uploading, the system generates a unique downloadable link that automatically disappears after 3 hours.

Getting Started

We will set up our Node.js API using NPM, and then install some packages that will enable us to complete some tasks without having to rebuild the wheels.

Project Structure

Let's setup our Node app
alt text

Application Folder

This is how our application folder will be like
alt text

Application Packages

You should have created the project folders at this point to house all the source code. This app depends on a couple of packages and we will use npm to install them. Navigate to the project directory you just created and you should have seen that the npm init command automagically created a package.json file with the content below.

alt text

Installing addition dependencies

We need to install the following dependencies to make our work easy to implement

  1. dotenv - Loads environment variables from .env for nodejs projects.

  2. express - Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.

  3. cloudinary - Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.

  4. cors - CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.

  5. multer - Multer is a node.js middleware for handling multipart/form-data, which is primarily used for uploading files. It is written on top of busboy for maximum efficiency.

  6. mysql2 - fast node-mysql compatible mysql driver for node.js

  7. nodemon - Monitor for any changes in your node.js application and automatically restart the server - perfect for development

  8. request - Simplified HTTP request client.

Now let's run the npm install command or npm i for short

alt text

Conclusion

In this article, we went through generating our node app and downloading the necessary dependencies we need in our app. In the upcoming series, we will be putting the downloaded dependencies to good use and writing our custom functions. We will also be designing our database to handle our data.

See you in the next article!

Top comments (0)