How to upload file using BusBoy in combination with ExpressJS, NodeJS and TypeScript?

We believe adaptation to the latest trends in the coding. Hence, we have been using TypeScript in all our major projects. We love code the the frontend in Angular 2, React and the dynamic backend in NodeJS.

Here’s a small example we have created using TypeScript, NodeJS and ExpressJS to upload a file with BusBoy using Typescript.

Please follow the below steps.

Step 1: Clone repository with the following command.

git clone

Step 2: Go to project directory and run

npm install

Step 3: Now execute. ( npm run grunt command is for compiling the typescript

source code, you can check out gruntfile.js have all the configuration. )

npm run grunt

Step 4: Create images folder inside the dist folder

mkdir dist/images

Step 5: Now run

npm run start

Step 7: Here is the URL for file upload

http://localhost:8080/fileupload and pass multipart form data.

Brief information about Typescript files.

  1. server.ts in src folder -> In this file we export the Server class, this class will configure our express web application, REST API and routes.
  2. route.ts in src/routes/ folder -> This file will export the BaseRoute class, In this class you can define script for all routes which will be required. Method render() will invoke BaseRoute’s child class.
  3. index.ts in src/routes/ folder -> This class extends BaseRoute class, you can define route in create() method.
  4. routes() method in server.ts -> In this method we have created router instance of express.Router() and call the create() method of IndexRoute and passed router as a parameter.

I hope the steps have got the example running in you local machine. We love to share at Third Rock Techkno what we learn with our community.

Happy coding !!!

Do share your feedback. :)

· · · ·

Third Rock Techkno is a leading IT services company. We are a top-ranked web, voice and mobile app development company with over 10 years of experience. Client success forms the core of our value system.

We have expertise in the latest technologies including angular, react native, iOs, Android and more. Third Rock Techkno has developed smart, scalable and innovative solutions for clients across a host of industries.

Our team of dedicated developers combine their knowledge and skills to develop and deliver web and mobile apps that boost business and increase output for our clients.

5 Reasons Why a Bad UX Can be dangerous for your App

As we approach the year 2020 the emphasis on consumer or user-driven products could not be any stronger. The narrative has now changed from Customer is King to Value Creation for Your Users.

Read More

React Native App development- How it differs from Native development?

At first glance, it may be difficult to find differences between React Native app development and Native development, but both are actually different from one another.

Read More

7 Reasons Why Angular is The Future of Enterprise-Scale Web Applications

Angular is an open-source, dynamic and full-featured framework developed by Google. A number of large companies have used Angular to build powerful and stable large scale enterprise applications.

Read More