// index.js
const getArgs = () =>
process.argv.reduce((args, arg) => {
// long arg
if (arg.slice(0, 2) === "--") {
const longArg = arg.split("=");
const longArgFlag = longArg[0].slice(2);
const longArgValue = longArg.length > 1 ? longArg[1] : true;
args[longArgFlag] = longArgValue;
Original article: https://www.smashingmagazine.com/2018/06/nodejs-tools-techniques-performance-servers/
Keeping Node.js Fast: Tools, Techniques, And Tips For Making High-Performance Node.js Servers — Smashing Magazine
- 18 min read
- Performance, Tools, Techniques, Node.js, Backend
When it comes to performance, what works in the browser doesn’t necessarily suit Node.js. So, how do we make sure a Node.js implementation is fast and fit for purpose? Node is a very versatile platform, but one of the predominant applications is creating networked processes. In this article David Mark Clements is going to focus on profiling the most common of these: HTTP web servers.
If you’ve been building anything with Node.js for long enough, then you’ve
Original Article: https://philcalcado.com/2019/07/12/some_thoughts_graphql_bff.html
The Back-end for Front-end (BFF) Pattern was originated at SoundCloud. It takes its name from the internal framework we built to make application-specific APIs easier to write and maintain. Since then, it has taken a life of its own, with various articles, books, and open source software that teach, discuss, or implement it.
More recently, another approach to API architecture and design comes in the form of GraphQL. Facebook first developed the technology, and it has quickly become so popular that many startups were created exclusively to build frameworks and tooling around it.
Over the past year or so, I have been asked many times about the relationship between these two. This article is a write-up of my thoughts on the matter.
What is a BFF, even?
1. Relational Databases (RDBMS)
Characteristics:
- Structure: Data is organized in tables (rows and columns).
- Schema: Requires a predefined schema.
- Integrity: Enforces data integrity through constraints and keys (primary, foreign).
- SQL: Uses Structured Query Language (SQL) for data manipulation and querying.
Advantages:
Document-Oriented Databases
- Overview: MongoDB is a popular open-source, document-oriented database designed for scalability and flexibility.
- Data Storage: Uses JSON-like documents (BSON format) which can have nested fields, arrays, and various data types.
- Schema Flexibility: Schema-less design allows dynamic and evolving data structures.
- To create docker image from
Dockerfile
, rundocker build . -t <your-image-name>
- to run the created docker image, run
docker run -d --publish <localhost-port>:<container-port> <your-image-name>
- To view the created image in the images list, run
docker image list
. this should list the created image - Once completed, to verify the contents of the image, run
docker run -ti <your-image-name> bash
- To verify the contents of the container, run
docker exec -it <your-container-name> bash
- To delete a docker image, run
docker image rm <space-seperated-image-names> -f
- To create images from a
yml
file, rundocker compose build
. This will by default pickdocker-compose.yml
andDockerfile
files. To build image through a different config file then rundocker compose -f <custom-config-yml> build
. - To run containers through
docker-compose.yaml
file, rundocker compose up
. For a different yaml file, rundocker compose -f up
Reference link: https://www.youtube.com/watch?v=zs3tyVgiBQQ
- Build Docker Image
docker build -t test .
- Run container /w image
docker run -d --publish 8888:5000 test
## ===========================================================> The common stage | |
FROM node:16.14 AS base | |
ENV NODE_ENV=production | |
WORKDIR /app | |
COPY package*.json ./ | |
RUN npm ci --only=production | |
## Remove unnecessary files from `node_modules` directory |
Original Article: https://kodekloud.com/blog/kubernetes-objects/
Kubernetes is a container orchestration tool, used to deploy & manage containerized applications in an automated way.
One of the key concepts in Kubernetes is the "desired state," which refers to the configurations of the applications that you want to deploy and run. Essentially, it's the way you want your applications to be set up and how you want them to behave in a Kubernetes environment. This includes things like how many instances of applications should be running, how those instances should be networked together, what resources they should have access to, and so on.
So, how do you define the desired state? By using objects.
What Are Kubernetes Objects?