Video Link: Apache Kafka Crash Course | What is Kafka?
- Knowledge
- Node.JS Intermediate level
- Experience with designing distributed systems
- Tools
- Node.js: Download Node.JS
- Docker: Download Docker
- VsCode: Download VSCode
type TPromiseResolve<T> = (value: T) => void; | |
type TPromiseReject<T> = (reason: T) => void; | |
type TPromiseExecutor<T, K> = ( | |
resolve: TPromiseResolve<T>, | |
reject: TPromiseReject<K> | |
) => void; | |
type TPromiseThenCallback<T> = (value: T | undefined) => void; | |
type TPromiseCatchCallback<T> = (reason: T | undefined) => void; |
CREATE TABLE log_events ( | |
event_id UUID, | |
timestamp DateTime MATERIALIZED now(), | |
deployment_id Nullable(String), | |
log String, | |
metadata Nullable(String) | |
) | |
ENGINE=MergeTree PARTITION BY toYYYYMM(timestamp) | |
ORDER BY (timestamp); |
FROM ubuntu | |
RUN apt-get update | |
RUN apt-get install -y curl | |
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - | |
RUN apt-get upgrade -y | |
RUN apt-get install -y nodejs | |
COPY package.json package.json | |
COPY package-lock.json package-lock.json |
Video Link: Apache Kafka Crash Course | What is Kafka?
Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
Create free AWS Account at https://aws.amazon.com/
I would be creating a t2.medium ubuntu machine for this demo.
Video Tutorial: https://youtu.be/Qmld1te08Ns
Update Packages
sudo apt-get update
Install Nginx
buyButton.addEventListener('click', async (event) => { | |
const response = await fetch('/order', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({ amount: 500 }) // Rs.500 | |
}); |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Razorpay</title> | |
</head> | |
<body> | |
<div> |
const { request, response } = require('express'); | |
const express = require('express'); | |
const Razorpay = require('razorpay'); | |
const app = express(); | |
const PORT = 8000; | |
app.use(express.static('./public')); | |
app.use(express.json()); |
const express = require('express'); | |
const app = express(); | |
const PORT = 8000; | |
app.use(express.static('./public')); | |
app.use(express.json()); |