Skip to main content

Posts

Showing posts from November, 2021

Working With Gulp and PM2

Gulp is one of the popular task runner tools which can be integrated and works well with various helper tools for code development. I've previously created a post about how Gulp can be interoperated with Nodemon . In this post, I try to show how it can work along with PM2. PM2 is a powerful process manager that can run on multiple platforms and support a variety of technologies. PM2 is quite different from Nodemon. Nodemon specifically only focuses on monitoring of Node.js application. On the other hand, PM2 is a process manager with rich features for maintaining many application processes in a time, even with support for clustering mechanism. Besides, PM2 is usually implemented as a daemon program, so we will need a different approach to integrate it with Gulp. For instance, we use Gulp to do some stuff such as linting, translating, or file copying after each code changes. After Gulp runs its main tasks, we will instruct Gulp to restart or stop the application process which is

Levi Ackerman, Nothing Left

Who is your favorite character in Attack on Titan?

Specify Different Certificates To Access Different Git Repositories

Besides HTTPS, we can make a connection to a Git repository using SSH. For authentication, we should store our public key on the remote host, and set the remote Git URL on our host to the correct address for SSH connection. For example: git remote set-url myremote ssh://git@myremotegit.com/myrepo.git Common SSH client tools provide a specific parameter to set which private key should be used for authentication. For example, the OpenSSH client provides -i parameter to specify the location of the private key that will be used. Meanwhile, common Git client tools may not provide it. When we run a Git command, the tool will look for a private key stored in the default directory which is ~/.ssh/id_rsa . We can resolve this issue by setting up a configuration file that will be stored in ~/.ssh/config . For instance, this is a sample of a configuration file. Host myremotegit HostName myremotegit.com User git IdentityFile C:\\keys1\\id_rsa IdentitiesOnly yes Host bitbucket-com

Create A GraphQL Server Using Express and Apollo Server

GraphQL can be described as a query language for API. GraphQL was initiated by Facebook developers when they tried to build a better data fetching mechanism for their mobile application. By using GraphQL, frontend developers can request any data from the backend server with specified format and properties based on their actual needs. Creating a server that has support for handling GraphQL-based requests has become easy nowadays. Express as a de-facto framework for building HTTP server has the capability to be integrated with Apollo Server which is a popular GraphQL server. Minimal modules that we need are express , graphql , and apollo-server-express . For instance, we will set up a project and build the requirements. We utilize ESM syntax for building the sample program. Firstly, we initiate the project and install the dependencies. mkdir express-graphql cd ./express-graphql yarn init -y yarn add express graphql apollo-server-express Because we use ESM syntax, we need to set the