When developing node applications one of the common problems you may encounter is when uploading files. There are many ways to upload files in your node application. Multer can be used to upload files in your application and the uploaded files will be stored in the local storage. However if you want to deploy your program online then storing the files locally would not be a wise decision because the location you save it might not the same when the application is deployed in the cloud. Therefore a cloud based file storage solution is required. There are many solutions for…
Many of you might’ve come across a situation where you had to upload an image or any type of file to the server. Some of you might’ve succeeded while some of you might’ve failed. This blog will demonstrate how a library called Multer helps to store the files selected from the client side to a local storage and store the file name to the database so that file name could be used to locate the file in the local storage.
Multer is a node js middleware which helps to upload files. You have to make sure that your form…
Establishing a connection with MongoDB and React using Koa js
In this blog we will be looking at connecting the Mongo DB with React so that data manipulations could be done in the front-end with data stored in the local server.
dependencies you will need for the front-end:
axios will be used for http requests in this example
dependencies you will need for the back-end:
koa,@koa/cors, mongodb, koa-bodyparser
Let’s start with the backend
First you need to set up your back-end server with Koa
What is React Hooks?
This feature is available in the latest version of React which enables programmers to write the usual react programs and handle the state without converting them into class components. React programmers would know that state cannot be created without the help of classes and with React Hooks that could be made possible by using useStateHook within a functional based component. Hooks cannot be used within classes since it allows you to use it without the help of classes which will not allow to use the lifecycle methods such as componentDidMount, componentDidUpdate, componentWillUnmount etc. …
As many of you might know that MongoDB is a highly popular non-structured database used by many growing organizations such as Google, Adobe , eBay etc. MongoDB Atlas could be used to store your applications data in the cloud. Even though it is highly scalable and easy to manage, one of the main downsides of it is that, only 512mb of storage would be available to use for free and any extension of storage should be purchased.