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.
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.
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.
We need to install the following dependencies to make our work easy to implement
dotenv- Loads environment variables from .env for nodejs projects.
express- Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
cloudinary- Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.
cors- CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
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.
mysql2- fast node-mysql compatible mysql driver for node.js
nodemon- Monitor for any changes in your node.js application and automatically restart the server - perfect for development
request- Simplified HTTP request client.
Now let's run the
npm install command or
npm i for short
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!