#nodejs #uploadfile #excel
#mysql #express #restapi #multer #sequelize #ajax
Tutorial: Nodejs Upload Excel files to MySQL/PostgreSQL – (Express RestAPI Upload/Import Download/Export Multiple Excel files)
Link: https://loizenai.com/nodejs-upload-ex...
Nodejs Upload Excel files to MySQL/PostgreSQL – (Express RestAPI Upload/Import Download/Export Multiple Excel files)
In the tutorial, I will introduce how to build a Nodejs/Express RestAPIs application to upload/import and download/extract data from multiple Excel files to MySQL or PostgreSQL database by:
Express is used to build Nodejs RestApis
Multer is used to upload/download Excel files
Sequelize ORM is used to manipulate data with MySQL/PostgreSQL
Exceljs is used to save data objects to Excel file
Read-excel-file is used to parse Excel file to data objects
We build Nodejs RestAPIs on the top of Express framework and use the Multer library to handle upload multiple excel files. For handling the business processing of our application, We implement a Controller.js that uses exceljs and read-excel-file libraries to write/read data objects to excel files. And for doing CRUD operations with MySQL and PostgreSQL database, we use Sequelizez ORM to finalize the jobs.
Project Structure:
config package is used to setup database configuration with Sequelize ORM and Multer’s configuration for uploading file
models package is used to define Sequelize Customer model
routers package is used to define Express router for Nodejs RestAPIs
controllers is used to implement coding to read/write Excel files and interact with database (storing/retrieving)
view package is used to define a html view page for upload/download Excel files
resource/static/js is used to implement Ajax Javascript code to upload multiples Excel files