The server component would then be responsible for reconstructing the file content in the correct order. One possible way to speed up the upload would be to read and send the file in separate byte range chunks. For example, say you wanted to write an async file uploader. Inside that folder create a file called index.In some cases reading the entire file into memory isn't the best option. In your root folder create a new folder called config.
Once your MongoDB instance is up and running let's begin integrating MongoDB in our code as well. Here is a small video I found on YouTube that gives a 6 minute intro to Robo3T: (You can use any GUI client that you like for this. Now you should have your MongoDB instance running and Robo3T installed. If you are having issues installing MongoDB, just let me know at and I'll write a custom guide for you or make an installation video guide. Let's setup MongoDB in our applicationīefore we add MongoDB to our code base, make sure it is installed in your machine by running one of the following:
Nothing fancy so far that I haven't covered in the videos above.
Next initialize a new npm project in your project root folder by typing the following: npm init -yĪnd install the following packages: npm i cors express jsonwebtoken mongoose morgan socket.io uuid -save Īnd in your package.json scripts section add the following 2 scripts: "scripts": Getting startedĬreate a folder called chat-app: mkdir chat-app
Let's begin now that you know the basics of ExpressJS and how to validate a user response. If you like this tutorial kindly leave a star on the github repository. If you have any feedback, please just reach out to me on. The entire source code of this tutorial can be found here. Īnd here's the make-validation library link. Here's the GitHub link to the entire source code of this video. In the below video, you'll learn how to write your own custom validation using a library called "make-validation": Adding API validation to your API end-point
It has all the relevant learning links I mention in the video along with an amazing half hour tutorial on postman. I talk about all this and more (including REST conventions) in this video:Īlso, here's a GitHub link to the entire source code of this video ĭo have a look at the README.md for "Chapter 0" source code. What are routes? Controllers? How do we allow for CORS (cross origin resource sharing)? How do we allow enduser to send data in JSON format in API request?