Node.js (2)

Uploading Files to Google Cloud Storage in AdonisJS

To upload many files from the profile photo to pdf, almost every web application needs a file upload method. If you want it to be good enough, you'll probably need to do a lot on both the backend and the frontend. We will leave frontend as the subject of another article and discuss how to upload files in an AdonisJs project efficiently using Google Cloud Storage.

It is much easier to deal with file uploads in AdonisJs than many other frameworks. However, I should say that, extending file upload and file storage functionality is not as easy as it should be. Things can get out of hand especially if you want to upload the files directly into a cloud storage in the same time while it has been streaming.

Stria and all the things what makes Stria are served on Google Cloud. For sure, Google Cloud Storage is used as file storage as well. For now, AdonisJs does not offer a native storage driver for Google Cloud Storage. In this article, we will explain the detail of how to upload files on to the Google Cloud Storage (aka Buckets) in AdonisJs framework.

Normally, in order to upload a file to an external storage, the file needs to be saved in a temporary directory first. Then it is moved from the temp directory to the destination (AWS, Space, Cloud). In this case more than one I/O read/write occurs. Although it is not easy to handle file storage on AdonisJs, there is no need for an external library to stream the file to a cloud storage, expect the provider's storage SDK.
Let’s get dive!

Read more

Awesome AdonisJs & Best Practices #1

AdonisJs is a Node.js MVC framework that runs on all major operating systems. It offers a stable eco-system to write a server-side web application so that you can focus on business needs over finalizing which package to choose or not.

The purpose of this article is to show the best practices to improve productivity for  AdonisJs based business logics.

Read more