mirror of
https://github.com/namibia/awesome-cheatsheets.git
synced 2024-12-20 01:03:14 +00:00
Merge branch 'master' of https://github.com/LeCoupa/awesome-cheatsheets
Merge
This commit is contained in:
commit
38957bd2be
26
README.md
26
README.md
@ -1,24 +1,19 @@
|
||||
![AWESOME CHEATSHEETS LOGO](_images/awesome_cheatsheets_logo@2x.png)
|
||||
![AWESOME CHEATSHEETS LOGO](_design/cover_github@2x.png)
|
||||
|
||||
[![Awesome](https://awesome.re/badge.svg)](https://awesome.re)
|
||||
[![Awesome](https://awesome.re/badge.svg)](https://awesome.re) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/LeCoupa/awesome-cheatsheets/blob/master/LICENSE)
|
||||
|
||||
> 📚 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file.
|
||||
|
||||
> ❤️ **If you like this repository, [you can click here to tweet it and make it spread](https://ctt.ec/PHba4).**
|
||||
|
||||
|
||||
## 🎩 Why Awesome-Cheatsheets?
|
||||
## 🤔 Why Awesome-Cheatsheets?
|
||||
|
||||
I always make a cheatsheet when I want to improve my skills on a programming language, a framework or a development tool. [I started doing these kind of things a long time ago on Gist](https://gist.github.com/LeCoupa) To better keep track of the history and to let people contribute to them, I reorganized everything into this single repository. Most of the content is coming from official documentations and some books I have read.
|
||||
|
||||
Feel free to browse each cheatsheet to learn new things and to keep them at hand when you forgot about one command. They have been designed to provide a quick way to assess your knowledge and to save you time.
|
||||
|
||||
|
||||
## 🙌🏼 How to Contribute?
|
||||
|
||||
You are more than welcome to contribute and build your own cheatsheet for your favorite programming language, framework or development tool. Just submit changes via pull request and I will review them before merging.
|
||||
|
||||
|
||||
## 📚 Table of Contents
|
||||
|
||||
### 📃 Languages
|
||||
@ -52,6 +47,7 @@ You are more than welcome to contribute and build your own cheatsheet for your f
|
||||
#### Javascript
|
||||
|
||||
* [Feathers.js](backend/feathers.js)
|
||||
* [Moleculer](backend/moleculer.js)
|
||||
* [Node.js](backend/node.js)
|
||||
</details>
|
||||
|
||||
@ -67,6 +63,7 @@ You are more than welcome to contribute and build your own cheatsheet for your f
|
||||
|
||||
#### Frameworks
|
||||
|
||||
* [React.js](frontend/react.js)
|
||||
* [Vue.js](frontend/vue.js)
|
||||
</details>
|
||||
|
||||
@ -95,24 +92,33 @@ You are more than welcome to contribute and build your own cheatsheet for your f
|
||||
#### Infrastructure
|
||||
|
||||
* [Docker](tools/docker.sh)
|
||||
* [Kubernetes](tools/kubernetes.sh)
|
||||
* [Nanobox Boxfile](tools/nanobox_boxfile.yml)
|
||||
* [Nanobox CLI](tools/nanobox_cli.sh)
|
||||
</details>
|
||||
|
||||
|
||||
## 🙌🏼 How to Contribute?
|
||||
|
||||
You are more than welcome to contribute and build your own cheatsheet for your favorite programming language, framework or development tool. Just submit changes via pull request and I will review them before merging.
|
||||
|
||||
|
||||
## 🙏🏻 Contribution
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://anyleads.com/" target="_blank"><img src="https://pbs.twimg.com/profile_images/838140522476761094/A4WpBe5M_400x400.jpg" height="64" /></a>
|
||||
<a href="https://crisp.chat/?ta=oR1nEv43TM" target="_blank"><img src="https://pbs.twimg.com/profile_images/651629444944273408/r5Kd_ifq_400x400.png" height="64" /></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://crisp.chat/" target="_blank"><img src="https://pbs.twimg.com/profile_images/651629444944273408/r5Kd_ifq_400x400.png" height="64" /></a>
|
||||
<a href="http://try.anyleads.com/secret" target="_blank"><img src="https://pbs.twimg.com/profile_images/838140522476761094/A4WpBe5M_400x400.jpg" height="64" /></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://hackr.io/" target="_blank"><img src="https://d1eq8vvyuam4eq.cloudfront.net/assets/images/code-images/code-apple-touch-icon-precomposed.png" height="64" /></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://learnk8s.io/" target="_blank"><img src="https://pbs.twimg.com/profile_images/925127335573114880/9yCkEIe3_400x400.jpg" height="64" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
BIN
_design/Awesome Cheatsheets.sketch
Normal file
BIN
_design/Awesome Cheatsheets.sketch
Normal file
Binary file not shown.
BIN
_design/awesome_cheatsheets_logo.png
Normal file
BIN
_design/awesome_cheatsheets_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
_design/awesome_cheatsheets_logo.psd
Normal file
BIN
_design/awesome_cheatsheets_logo.psd
Normal file
Binary file not shown.
BIN
_design/awesome_cheatsheets_logo@2x.png
Normal file
BIN
_design/awesome_cheatsheets_logo@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
_design/awesome_cheatsheets_logo@4x.png
Normal file
BIN
_design/awesome_cheatsheets_logo@4x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
BIN
_design/cover_github@2x.png
Normal file
BIN
_design/cover_github@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 38 KiB |
@ -15,7 +15,7 @@
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
```bash
|
||||
```
|
||||
# Provides the ability to initialize new application instances
|
||||
npm install @feathersjs/feathers --save
|
||||
|
||||
@ -185,7 +185,7 @@ app.on('login', (payload, info) => {}) // sent by the authentication module and
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
```bash
|
||||
```
|
||||
# Contains Express framework integrations
|
||||
npm install @feathersjs/express --save
|
||||
|
||||
@ -252,7 +252,7 @@ app.configure(primus(options, callback)) // sets up the Primus transport with t
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
```bash
|
||||
```
|
||||
# Bundles the separate Feathers client side modules into one providing the code as ES5 (compatible with modern browsers)
|
||||
# You do not have to install or load any of the other modules listed below
|
||||
npm install @feathersjs/client --save
|
||||
@ -299,7 +299,7 @@ primus(socket, options) // initialize the Primus client using a given socket an
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
```bash
|
||||
```
|
||||
# Assists in using JWT for authentication
|
||||
npm install @feathersjs/authentication --save
|
||||
|
||||
@ -562,7 +562,7 @@ app.service('authentication').hooks({
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
```bash
|
||||
```
|
||||
# [MEMORY/FILESYSTEM] In-memory database adapter
|
||||
npm install feathers-memory --save
|
||||
|
||||
|
747
backend/moleculer.js
Normal file
747
backend/moleculer.js
Normal file
@ -0,0 +1,747 @@
|
||||
/* *******************************************************************************************
|
||||
* MOLECULER MICROSERVICES FRAMEWORK - CORE CHEATSHEET
|
||||
* http://moleculer.services/0.12/docs/
|
||||
*
|
||||
* Version: 0.12.x
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* Install Moleculer
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
```bash
|
||||
npm i moleculer
|
||||
```
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* SERVICE BROKER OPTIONS
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// All ServiceBroker options with default values
|
||||
const broker = new ServiceBroker({
|
||||
namespace: "", // Namespace for node segmentation
|
||||
nodeID: null, // NodeID. Default value is generated from hostname and PID
|
||||
|
||||
logger: null, // Logger instance.
|
||||
logLevel: null, // Log level
|
||||
logFormatter: "default", // Log formatter. Options: "default", "simple"
|
||||
|
||||
transporter: null, // Transporter config
|
||||
requestTimeout: 0 * 1000, // Timeout of requests
|
||||
requestRetry: 0, // Retries for requests
|
||||
maxCallLevel: 0, // Maximum calling level.
|
||||
heartbeatInterval: 5, // Heartbeat sending interval in seconds
|
||||
heartbeatTimeout: 15, // Heartbeat timeout in seconds
|
||||
|
||||
disableBalancer: false, // Disable the built-in Moleculer balancer
|
||||
|
||||
registry: { // Service Registry options
|
||||
strategy: "RoundRobin", // Invocation strategy
|
||||
strategyOptions: null, // Strategy options
|
||||
preferLocal: true // Prefer local invocations
|
||||
},
|
||||
|
||||
circuitBreaker: { // Circuit-breaker options
|
||||
enabled: false, // Enable circuit-breaker
|
||||
maxFailures: 3, // Maximum failures
|
||||
halfOpenTime: 10 * 1000, // Half-open time interval
|
||||
failureOnTimeout: true, // Failure on timeouts
|
||||
failureOnReject: true // Failure on rejects
|
||||
},
|
||||
|
||||
transit: { // Transit options
|
||||
maxQueueSize: 50 * 1000 // Max items in outgoing queue
|
||||
},
|
||||
|
||||
cacher: null, // Cacher config
|
||||
serializer: null, // Serializer config
|
||||
|
||||
validation: true, // Enable params validation
|
||||
validator: null, // Validator instance
|
||||
metrics: false, // Enable metrics
|
||||
metricsRate: 1, // Metrics rate
|
||||
statistics: false, // Enable statistics
|
||||
internalServices: true, // Load internal ($node) services
|
||||
|
||||
hotReload: false, // Hot-reload services
|
||||
|
||||
middlewares: null, // List of middlewares
|
||||
|
||||
replCommands: null, // Custom REPL commands
|
||||
|
||||
ServiceFactory: null, // Custom Service factory class
|
||||
ContextFactory: null // Custom Context factory class
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* SERVICE BROKER METHODS
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Broker properties
|
||||
broker.Promise // Pointer to Bluebird Promise lib
|
||||
broker.namespace // Namespace from options
|
||||
broker.nodeID // Local NodeID
|
||||
broker.logger // Logger instance
|
||||
broker.cacher // Cacher instance
|
||||
broker.serializer // Serializer instance
|
||||
broker.validator // Validator instance
|
||||
|
||||
// Broker methods
|
||||
broker.start(); // Start broker & all services. Returns a Promise
|
||||
broker.stop(); // Stop broker & all services. Returns a Promise
|
||||
broker.fatal(message, err, needExit = true); // Fired a fatal error.
|
||||
broker.repl(); // Switch broker to REPL mode.
|
||||
|
||||
broker.getLogger(module, service, version); // Create a custom logger instance for modules
|
||||
|
||||
broker.loadServices(folder, fileMask); // Load all services from directory
|
||||
broker.loadService(filePath); // Load a service from a file
|
||||
broker.createService(schema, schemaMods); // Create a local service from schema
|
||||
broker.destroyService(service); // Destroy a local service
|
||||
broker.getLocalService(name, version); // Get a local service instance by name
|
||||
|
||||
// Wait for services. Returns a Promise
|
||||
await broker.waitForServices(serviceNames, timeout, interval);
|
||||
await broker.waitForServices(["posts", "users"], 5000);
|
||||
await broker.waitForServices({
|
||||
name: "posts", version: 2,
|
||||
name: "users", version: 1
|
||||
}, 5000);
|
||||
|
||||
broker.use(...middlewares); // Register middlewares
|
||||
|
||||
broker.call(actionName, params, opts); // Call a service
|
||||
broker.mcall(def); // Multiple service calls
|
||||
|
||||
broker.emit(eventName, payload, groups); // Emit a balanced event
|
||||
broker.broadcast(eventName, payload, groups = null) // Broadcast an event
|
||||
broker.broadcastLocal(eventName, payload, groups = null) // Broadcast an event to local services
|
||||
|
||||
broker.sendPing(nodeID); // Ping a remote node
|
||||
broker.MOLECULER_VERSION // Version number of Moleculer lib
|
||||
broker.PROTOCOL_VERSION // Version number of Moleculer protocol
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* BROKER SERVICE CALLS
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Call the "users.get" service with params
|
||||
broker.call("users.get", { id: 150 }).then(user => console.log(user));
|
||||
|
||||
// Call with async/await
|
||||
const user = await broker.call("users.get", { id: 150});
|
||||
|
||||
// Call with calling options
|
||||
const user = await broker.call("users.get", { id: 150}, { timeout: 5000, retryCount: 3 });
|
||||
|
||||
// Direct call to a remote node
|
||||
const info = await broker.call("$node.services", null, { nodeID: "node-123" });
|
||||
|
||||
// Multiple calls with array def
|
||||
const [posts, users] = await broker.mcall([
|
||||
{ action: "posts.find", params: { limit: 5, offset: 0 } },
|
||||
{ action: "users.find", params: { limit: 5, sort: "username" }, opts: { timeout: 500 } }
|
||||
]);
|
||||
|
||||
// Multip calls with object def
|
||||
const res = await broker.mcall({
|
||||
posts: { action: "posts.find", params: { limit: 5, offset: 0 } },
|
||||
users: { action: "users.find", params: { limit: 5, sort: "username" }, opts: { timeout: 500 } }
|
||||
});
|
||||
console.log(res.posts, res.users);
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* BROKER EVENTS
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Send a balanced event with payload
|
||||
broker.emit("user.created", { user: user });
|
||||
|
||||
// Send a balanced event only for "mail" and "payment" service (only one instance)
|
||||
broker.emit("user.created", { user: user }, ["mail", "payment"]);
|
||||
|
||||
// Send a broadcast event (for all service instances)
|
||||
broker.broadcast("user.created", { user: user });
|
||||
|
||||
// Send a broadcast event only for "mail" and "payment" services (all instances)
|
||||
broker.broadcast("user.created", { user: user }, ["mail", "payment"]);
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* NATS TRANSPORTER
|
||||
* Requirement: `npm i nats`
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Default options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "NATS"
|
||||
});
|
||||
|
||||
// With URI
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "nats://localhost:4222"
|
||||
});
|
||||
|
||||
// With options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: {
|
||||
type: "NATS",
|
||||
options: {
|
||||
url: "nats://localhost:4222",
|
||||
user: "admin",
|
||||
pass: "1234"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// With TLS (https://github.com/nats-io/node-nats#tls)
|
||||
const broker = new ServiceBroker({
|
||||
transporter: {
|
||||
type: "NATS",
|
||||
options: {
|
||||
url: "nats://localhost:4222",
|
||||
tls: {
|
||||
key: fs.readFileSync('./client-key.pem'),
|
||||
cert: fs.readFileSync('./client-cert.pem'),
|
||||
ca: [ fs.readFileSync('./ca.pem') ]
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* REDIS TRANSPORTER
|
||||
* Requirement: `npm i ioredis`
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Default options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "Redis"
|
||||
});
|
||||
|
||||
// With URI
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "redis://redis-server:6379"
|
||||
});
|
||||
|
||||
// With options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: {
|
||||
type: "Redis",
|
||||
options: {
|
||||
port: 6379, // Redis port
|
||||
host: 'redis-server', // Redis host
|
||||
family: 4, // 4 (IPv4) or 6 (IPv6)
|
||||
password: 'auth', // Password
|
||||
db: 0 // Database index
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* MQTT TRANSPORTER
|
||||
* Requirement: `npm i mqtt`
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Default options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "MQTT"
|
||||
});
|
||||
|
||||
// With URI
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "mqtt://mqtt-server:1883"
|
||||
});
|
||||
|
||||
// With options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: {
|
||||
type: "MQTT",
|
||||
options: {
|
||||
host: "mqtt-server",
|
||||
port: 1883,
|
||||
username: "admin",
|
||||
password: "1234"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* AMQP TRANSPORTER
|
||||
* Requirement: `npm i amqplib`
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Default options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "AMQP"
|
||||
});
|
||||
|
||||
// With URI
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "amqp://rabbitmq-server:5672"
|
||||
});
|
||||
|
||||
// With options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: {
|
||||
type: "AMQP",
|
||||
options: {
|
||||
url: "amqp://user:pass@rabbitmq-server:5672",
|
||||
eventTimeToLive: 5000,
|
||||
prefetch: 1
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* KAFKA TRANSPORTER
|
||||
* Requirement: `npm i kafka-node`
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Default options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "Kafka"
|
||||
});
|
||||
|
||||
// With URI
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "kafka://192.168.51.29:2181"
|
||||
});
|
||||
|
||||
// With options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: {
|
||||
type: "kafka",
|
||||
options: {
|
||||
host: "192.168.51.29:2181",
|
||||
|
||||
// KafkaClient options. More info: https://github.com/SOHU-Co/kafka-node#clientconnectionstring-clientid-zkoptions-noackbatchoptions-ssloptions
|
||||
client: {
|
||||
zkOptions: undefined,
|
||||
noAckBatchOptions: undefined,
|
||||
sslOptions: undefined
|
||||
},
|
||||
|
||||
// KafkaProducer options. More info: https://github.com/SOHU-Co/kafka-node#producerclient-options-custompartitioner
|
||||
producer: {},
|
||||
customPartitioner: undefined,
|
||||
|
||||
// ConsumerGroup options. More info: https://github.com/SOHU-Co/kafka-node#consumergroupoptions-topics
|
||||
consumer: {
|
||||
},
|
||||
|
||||
// Advanced options for `send`. More info: https://github.com/SOHU-Co/kafka-node#sendpayloads-cb
|
||||
publish: {
|
||||
partition: 0,
|
||||
attributes: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* NATS STREAMING TRANSPORTER
|
||||
* Requirement: `npm i node-nats-streaming`
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Default options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "STAN"
|
||||
});
|
||||
|
||||
// With URI
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "stan://192.168.0.120:4222"
|
||||
});
|
||||
|
||||
// With options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: {
|
||||
type: "STAN",
|
||||
options: {
|
||||
url: "stan://127.0.0.1:4222",
|
||||
clusterID: "my-cluster"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* TCP STREAMING TRANSPORTER
|
||||
* No requirements
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Default options
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "TCP"
|
||||
});
|
||||
|
||||
// With static node list
|
||||
const broker = new ServiceBroker({
|
||||
transporter: "tcp://172.17.0.1:6000/node-1,172.17.0.2:6000/node-2"
|
||||
});
|
||||
|
||||
const broker = new ServiceBroker({
|
||||
nodeID: "node-1",
|
||||
transporter: {
|
||||
type: "TCP",
|
||||
options: {
|
||||
udpDiscovery: false,
|
||||
urls: [
|
||||
"172.17.0.1:6000/node-1",
|
||||
"172.17.0.2:6000/node-2",
|
||||
"172.17.0.3:6000/node-3"
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// With full options
|
||||
const broker = new ServiceBroker({
|
||||
logger: true,
|
||||
transporter: {
|
||||
type: "TCP",
|
||||
options: {
|
||||
// Enable UDP discovery
|
||||
udpDiscovery: true,
|
||||
// Reusing UDP server socket
|
||||
udpReuseAddr: true,
|
||||
|
||||
// UDP port
|
||||
udpPort: 4445,
|
||||
// UDP bind address
|
||||
udpBindAddress: null,
|
||||
// UDP sending period
|
||||
udpPeriod: 5,
|
||||
|
||||
// Multicast address.
|
||||
udpMulticast: "239.0.0.0",
|
||||
// Multicast TTL setting
|
||||
udpMulticastTTL: 1,
|
||||
|
||||
// Send broadcast
|
||||
udpBroadcast: false,
|
||||
|
||||
// TCP server port. Null or 0 means random port
|
||||
port: null,
|
||||
// Static remote nodes address list (when UDP discovery is not available)
|
||||
urls: null,
|
||||
// Use hostname as preffered connection address
|
||||
useHostname: true,
|
||||
|
||||
// Gossip sending period in seconds
|
||||
gossipPeriod: 2,
|
||||
// Maximum enabled outgoing connections. If reach, close the old connections
|
||||
maxConnections: 32,
|
||||
// Maximum TCP packet size
|
||||
maxPacketSize: 1 * 1024 * 1024
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* CACHERS
|
||||
* http://moleculer.services/docs/cachers.html
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Memory cacher
|
||||
const broker = new ServiceBroker({
|
||||
cacher: "Memory"
|
||||
});
|
||||
// or
|
||||
const broker = new ServiceBroker({
|
||||
cacher: true
|
||||
});
|
||||
|
||||
// Memory cacher with options
|
||||
const broker = new ServiceBroker({
|
||||
cacher: {
|
||||
type: "Memory",
|
||||
options: {
|
||||
ttl: 30
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Redis cacher
|
||||
const broker = new ServiceBroker({
|
||||
cacher: "Redis"
|
||||
});
|
||||
|
||||
// Redis cacher with URI
|
||||
const broker = new ServiceBroker({
|
||||
cacher: "redis://redis-server:6379"
|
||||
});
|
||||
|
||||
// Redis cacher with options
|
||||
const broker = new ServiceBroker({
|
||||
cacher: {
|
||||
type: "Redis",
|
||||
options: {
|
||||
prefix: "MOL",
|
||||
redis: {
|
||||
host: "redis",
|
||||
port: 6379,
|
||||
password: "1234",
|
||||
db: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* Manual caching
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Save to cache
|
||||
broker.cacher.set("mykey.a", { a: 5 });
|
||||
|
||||
// Get from cache
|
||||
const obj = await broker.cacher.get("mykey.a");
|
||||
|
||||
// Remove entry from cache
|
||||
broker.cacher.del("mykey.a");
|
||||
|
||||
// Clean all 'mykey' entries
|
||||
broker.cacher.clean("mykey.*");
|
||||
|
||||
// Clean all entries
|
||||
broker.cacher.clean();
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* SERIALIZER
|
||||
* http://moleculer.services/docs/serializers.html
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// JSON serializer (default)
|
||||
const broker = new ServiceBroker({
|
||||
serializer: "JSON"
|
||||
});
|
||||
|
||||
// Avro serializer (need `npm i avsc`)
|
||||
const broker = new ServiceBroker({
|
||||
serializer: "Avro"
|
||||
});
|
||||
|
||||
// Protocol Buffer serializer (need `npm i protobufjs`)
|
||||
const broker = new ServiceBroker({
|
||||
serializer: "ProtoBuf"
|
||||
});
|
||||
|
||||
// MsgPack serializer (need `npm i msgpack5`)
|
||||
const broker = new ServiceBroker({
|
||||
serializer: "MsgPack"
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* STRATEGY
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Round-robin strategy (default)
|
||||
const broker = new ServiceBroker({
|
||||
registry: {
|
||||
strategy: "RoundRobin"
|
||||
}
|
||||
});
|
||||
|
||||
// Random strategy
|
||||
const broker = new ServiceBroker({
|
||||
registry: {
|
||||
strategy: "Random"
|
||||
}
|
||||
});
|
||||
|
||||
// CPU usage-based strategy
|
||||
const broker = new ServiceBroker({
|
||||
registry: {
|
||||
strategy: "CpuUsageStrategy"
|
||||
}
|
||||
});
|
||||
|
||||
// CPU usage-based strategy with options
|
||||
const broker = new ServiceBroker({
|
||||
registry: {
|
||||
strategy: "CpuUsageStrategy",
|
||||
strategyOptions: {
|
||||
sampleCount: 3,
|
||||
lowCpuUsage: 10
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* LOGGER
|
||||
* http://moleculer.services/docs/logger.html
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Logger methods
|
||||
broker.logger.fatal();
|
||||
broker.logger.error();
|
||||
broker.logger.warn();
|
||||
broker.logger.info();
|
||||
broker.logger.debug();
|
||||
broker.logger.trace();
|
||||
|
||||
// Custom log formatter
|
||||
const broker = new ServiceBroker({
|
||||
logger: console,
|
||||
logFormatter(level, args, bindings) {
|
||||
return level.toUpperCase() + " " + bindings.nodeID + ": " + args.join(" ");
|
||||
}
|
||||
});
|
||||
|
||||
// External Pino logger
|
||||
const pino = require("pino")({ level: "info" });
|
||||
const broker = new ServiceBroker({
|
||||
logger: bindings => pino.child(bindings)
|
||||
});
|
||||
|
||||
// External Bunyan logger
|
||||
const logger = require("bunyan").createLogger({ name: "moleculer", level: "info" });
|
||||
const broker = new ServiceBroker({
|
||||
logger: bindings => logger.child(bindings)
|
||||
});
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* SERVICE SCHEMA
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
module.exports = {
|
||||
// Name
|
||||
name: "greeter",
|
||||
// Version
|
||||
version: 2,
|
||||
|
||||
// Settings
|
||||
settings: {},
|
||||
// Metadata
|
||||
metadata: {},
|
||||
// Dependencies
|
||||
dependencies: [],
|
||||
|
||||
// Actions
|
||||
actions: {
|
||||
// Shorthand actions
|
||||
hello() {
|
||||
// Call a method
|
||||
this.doSomething();
|
||||
|
||||
return "Hello Moleculer";
|
||||
},
|
||||
|
||||
// With properties
|
||||
welcome: {
|
||||
// Cache options
|
||||
cache: {
|
||||
keys: ["name"]
|
||||
},
|
||||
// Validation options
|
||||
params: {
|
||||
name: "string"
|
||||
},
|
||||
// Action handler
|
||||
handler(ctx) {
|
||||
return `Welcome, ${ctx.params.name}`;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
events: {
|
||||
"user.created"(payload, sender) {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// Service methods
|
||||
methods: {
|
||||
doSomething() {}
|
||||
},
|
||||
|
||||
// Lifecycle event handlers
|
||||
created() {
|
||||
console.log("Service created");
|
||||
},
|
||||
|
||||
started() {
|
||||
console.log("Service started");
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
stopped() {
|
||||
console.log("Service stopped");
|
||||
return Promise.resolve();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* SERVICE
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
this.name // Name of service
|
||||
this.version // Version of service
|
||||
this.settings // Settings of service
|
||||
this.schema // Schema definition of service
|
||||
this.broker // Broker instance
|
||||
this.Promise // Class of Promise (Bluebird)
|
||||
this.logger // Logger instance
|
||||
this.actions // Actions of service.
|
||||
this.waitForServices // Pointer to ‘broker.waitForServices’ method
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* CONTEXT
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
ctx.id // Context ID
|
||||
ctx.broker // Broker instance
|
||||
ctx.action // Action definition
|
||||
ctx.nodeID // Node ID
|
||||
ctx.requestID // Request ID
|
||||
ctx.parentID // ID of parent context (in case of sub-calls).
|
||||
ctx.params // Request params
|
||||
ctx.meta // Request metadata
|
||||
ctx.callerNodeID // Caller Node ID if it is requested from a remote node.
|
||||
ctx.level // Request level (in case of sub-calls). The first level is 1.
|
||||
|
||||
// Make a sub-call
|
||||
ctx.call(actionName, params, callingOptions)
|
||||
|
||||
// Emit an event
|
||||
ctx.emit(eventName, payload, groups);
|
434
frontend/angularjs.js
vendored
Normal file
434
frontend/angularjs.js
vendored
Normal file
@ -0,0 +1,434 @@
|
||||
/* *******************************************************************************************
|
||||
* ANGULARJS CHEATSHEET
|
||||
* API DOCUMENTATION: https://docs.angularjs.org/api
|
||||
* DEVELOPER GUIDE: https://docs.angularjs.org/guide
|
||||
* ERROR REFERENCE: https://docs.angularjs.org/error
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* TIPS & TRICKS
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// You can retrieve a scope for any DOM element by using:
|
||||
angular.element(aDomElement).scope()
|
||||
|
||||
// An object that contains information about the current AngularJS version.
|
||||
// This object has the following properties: full, major, minor, dot, codeName
|
||||
angular.version
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* CSS CLASS USED BY ANGULAR
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// AngularJS applies this class to any element for which a new scope is defined.
|
||||
ng-scope
|
||||
|
||||
// AngularJS applies this class to any element for which a new isolate scope is defined.
|
||||
ng-isolate-scope
|
||||
|
||||
// AngularJS applies this class to any element that is attached to a data binding, via ng-bind or {{}} curly braces, for example.
|
||||
ng-binding
|
||||
|
||||
// AngularJS applies this class to a form control widget element if that element's input does not pass validation.
|
||||
ng-invalid, ng-valid
|
||||
|
||||
// AngularJS ngModel directive applies ng-pristine class to a new form control widget which did not have user interaction.
|
||||
// Once the user interacts with the form control, the class is changed to ng-dirty.
|
||||
ng-pristine, ng-dirty
|
||||
|
||||
// AngularJS ngModel directive applies ng-untouched class to a new form control widget which has not been blurred.
|
||||
// Once the user blurs the form control, the class is changed to ng-touched.
|
||||
ng-touched, ng-untouched
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* NG MODULE > FUNCTIONS
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Returns a function which calls function fn bound to self (self becomes the this for fn).
|
||||
// You can supply optional args that are prebound to the function.
|
||||
// This feature is also known as partial application, as distinguished from function currying.
|
||||
angular.bind(self, fn, args)
|
||||
|
||||
// Use this function to manually start up AngularJS application.
|
||||
angular.bootstrap(element, [modules], [config])
|
||||
|
||||
// Creates a deep copy of source, which should be an object or an array.
|
||||
angular.copy(source, [destination])
|
||||
|
||||
// Wraps a raw DOM element or HTML string as a jQuery element.
|
||||
angular.element(element)
|
||||
|
||||
// Determines if two objects or two values are equivalent.
|
||||
// Supports value types, regular expressions, arrays and objects.
|
||||
angular.equals(o1, o2)
|
||||
|
||||
// Configure several aspects of error handling in AngularJS if used as a setter or return the current configuration if used as a getter.
|
||||
angular.errorHandlingConfig([config])
|
||||
|
||||
// Extends the destination object dst by copying own enumerable properties from the src object(s) to dst.
|
||||
// You can specify multiple src objects.
|
||||
angular.extend(dst, src)
|
||||
|
||||
// Invokes the iterator function once for each item in obj collection, which can be either an object or an array.
|
||||
angular.forEach(obj, iterator, [context])
|
||||
|
||||
// Deserializes a JSON string.
|
||||
angular.fromJson(json)
|
||||
|
||||
// A function that returns its first argument.
|
||||
// This function is useful when writing code in the functional style.
|
||||
angular.identity(value)
|
||||
|
||||
// Creates an injector object that can be used for retrieving services as well as for dependency injection.
|
||||
angular.injector(modules, [strictDi])
|
||||
|
||||
// Determines if a reference is an Array.
|
||||
angular.isArray(value)
|
||||
|
||||
// Determines if a value is a date.
|
||||
angular.isDate(value)
|
||||
|
||||
// Determines if a reference is defined.
|
||||
angular.isDefined(value)
|
||||
|
||||
// Determines if a reference is a DOM element (or wrapped jQuery element).
|
||||
angular.isElement(value)
|
||||
|
||||
// Determines if a reference is a Function.
|
||||
angular.isFunction(value)
|
||||
|
||||
// Determines if a reference is a Number.
|
||||
angular.isNumber(value)
|
||||
|
||||
// Determines if a reference is an Object. Unlike typeof in JavaScript, nulls are not considered to be objects.
|
||||
angular.isObject(value)
|
||||
|
||||
// Determines if a reference is a String.
|
||||
angular.isString(value)
|
||||
|
||||
// Determines if a reference is undefined.
|
||||
angular.isUndefined(value)
|
||||
|
||||
// The angular.module is a global place for creating, registering and retrieving AngularJS modules.
|
||||
// All modules (AngularJS core or 3rd party) that should be available to an application must be registered using this mechanism.
|
||||
// Passing one argument retrieves an existing angular.Module, whereas passing more than one argument creates a new angular.Module
|
||||
angular.module(name, [requires], [configFn])
|
||||
|
||||
// A function that performs no operations.
|
||||
// This function can be useful when writing code in the functional style.
|
||||
angular.noop()
|
||||
|
||||
// Use this function to reload the current application with debug information turned on.
|
||||
// This takes precedence over a call to $compileProvider.debugInfoEnabled(false).
|
||||
angular.reloadWithDebugInfo()
|
||||
|
||||
// Serializes input into a JSON-formatted string.
|
||||
// Properties with leading $$ characters will be stripped since AngularJS uses this notation internally.
|
||||
angular.toJson(obj, pretty)
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* NG MODULE > DIRECTIVES
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Use this directive to auto-bootstrap an AngularJS application.
|
||||
// Only one AngularJS application can be auto-bootstrapped per HTML document.
|
||||
// You can specify an AngularJS module to be used as the root module for the application.
|
||||
'ng-app'
|
||||
|
||||
// The ngBind attribute tells AngularJS to replace the text content of the specified HTML element with
|
||||
// the value of a given expression, and to update the text content when the value of that expression changes.
|
||||
'ng-bind'
|
||||
|
||||
// Evaluates the expression and inserts the resulting HTML into the element in a secure way.
|
||||
'ng-bind-html'
|
||||
|
||||
// The ngBindTemplate directive specifies that the element text content should be replaced with
|
||||
// the interpolation of the template in the ngBindTemplate attribute.
|
||||
'ng-bind-template'
|
||||
|
||||
// Specify custom behavior on blur event.
|
||||
'ng-blur'
|
||||
|
||||
// Evaluate the given expression when the user changes the input.
|
||||
'ng-change'
|
||||
|
||||
// Sets the checked attribute on the element, if the expression inside ngChecked is truthy.
|
||||
'ng-checked'
|
||||
|
||||
// The ngClass directive allows you to dynamically set CSS classes on an HTML element by databinding
|
||||
// an expression that represents all classes to be added.
|
||||
'ng-class'
|
||||
|
||||
// The ngClassOdd and ngClassEven directives work exactly as ngClass, except they work in
|
||||
// conjunction with ngRepeat and take effect only on odd (even) rows.
|
||||
'ng-class-even'
|
||||
|
||||
// The ngClassOdd and ngClassEven directives work exactly as ngClass, except they work in
|
||||
// conjunction with ngRepeat and take effect only on odd (even) rows.
|
||||
'ng-class-odd'
|
||||
|
||||
// The ngClick directive allows you to specify custom behavior when an element is clicked.
|
||||
'ng-click'
|
||||
|
||||
// The ngCloak directive is used to prevent the AngularJS html template from being briefly displayed
|
||||
// by the browser in its raw (uncompiled) form while your application is loading.
|
||||
'ng-cloak'
|
||||
|
||||
// The ngController directive attaches a controller class to the view.
|
||||
'ng-controller'
|
||||
|
||||
// Specify custom behavior on copy event.
|
||||
'ng-copy'
|
||||
|
||||
// Specify custom behavior on cut event.
|
||||
'ng-cut'
|
||||
|
||||
// Allows you to specify custom behavior on a dblclick event.
|
||||
'ng-dblclick'
|
||||
|
||||
// This directive sets the disabled attribute on the element (typically a form control, e.g. input, button, select etc.)
|
||||
// if the expression inside ngDisabled evaluates to truthy.
|
||||
'ng-disabled'
|
||||
|
||||
// Specify custom behavior on focus event.
|
||||
'ng-focus'
|
||||
|
||||
// Nestable alias of form directive. HTML does not allow nesting of form elements.
|
||||
// It is useful to nest forms, for example if the validity of a sub-group of controls needs to be determined.
|
||||
'ng-form'
|
||||
|
||||
// Shows or hides the given HTML element based on the expression provided to the ngHide attribute.
|
||||
'ng-hide'
|
||||
|
||||
// Executes the expression and replaces with the right href link
|
||||
'ng-href'
|
||||
|
||||
// Removes or recreates a portion of the DOM tree based on an {expression}.
|
||||
'ng-if'
|
||||
|
||||
// Fetches, compiles and includes an external HTML fragment.
|
||||
'ng-include'
|
||||
|
||||
// Allows you to evaluate an expression in the current scope.
|
||||
'ng-init'
|
||||
|
||||
// Force the angular.element library.
|
||||
// This should be used to force either jqLite by leaving ng-jq blank or setting the name of the jquery variable under window (eg. jQuery).
|
||||
'ng-jq'
|
||||
|
||||
// Specify custom behavior on keydown event.
|
||||
'ng-keydown'
|
||||
|
||||
// Specify custom behavior on keypress event.
|
||||
'ng-keypress'
|
||||
|
||||
// Specify custom behavior on keyup event.
|
||||
'ng-keyup'
|
||||
|
||||
// Text input that converts between a delimited string and an array of strings.
|
||||
'ng-list'
|
||||
|
||||
// Adds the maxlength validator to ngModel.
|
||||
'ng-maxlength'
|
||||
|
||||
// Adds the minlength validator to ngModel.
|
||||
'ng-minlength'
|
||||
|
||||
// The ngModel directive binds an input,select, textarea (or custom form control) to a property on the scope using NgModelController,
|
||||
// which is created and exposed by this directive.
|
||||
'ng-model'
|
||||
|
||||
// Modify the behaviour of ngModel directives within your application.
|
||||
// You can specify an ngModelOptions directive on any element.
|
||||
// All ngModel directives will use the options of their nearest ngModelOptions ancestor.
|
||||
'ng-model-options'
|
||||
|
||||
// Allows you to specify custom behavior on mousedown event.
|
||||
'ng-mousedown'
|
||||
|
||||
// Specify custom behavior on mouseenter event.
|
||||
'ng-mouseenter'
|
||||
|
||||
// Specify custom behavior on mouseleave event.
|
||||
'ng-mouseleave'
|
||||
|
||||
// Specify custom behavior on mousemove event.
|
||||
'ng-mousemove'
|
||||
|
||||
// Specify custom behavior on mouseover event.
|
||||
'ng-mouseover'
|
||||
|
||||
// Specify custom behavior on mouseup event.
|
||||
'ng-mouseup'
|
||||
|
||||
// Tells AngularJS not to compile or bind the contents of the current DOM element,
|
||||
// including directives on the element itself that have a lower priority than ngNonBindable.
|
||||
'ng-non-bindable'
|
||||
|
||||
// Sets the open attribute on the element, if the expression inside ngOpen is truthy.
|
||||
'ng-open'
|
||||
|
||||
// The ngOptions attribute can be used to dynamically generate a list of <option> elements for the <select>
|
||||
// element using the array or object obtained by evaluating the ngOptions comprehension expression.
|
||||
'ng-options'
|
||||
|
||||
// Specify custom behavior on paste event.
|
||||
'ng-paste'
|
||||
|
||||
// ngPattern adds the pattern validator to ngModel.
|
||||
// It is most often used for text-based input controls, but can also be applied to custom text-based controls.
|
||||
'ng-pattern'
|
||||
|
||||
// Displays messages according to en-US localization rules.
|
||||
'ng-pluralize'
|
||||
|
||||
// Sets the readonly attribute on the element, if the expression inside ngReadonly is truthy
|
||||
'ng-readonly'
|
||||
|
||||
// Instantiates a template once per item from a collection
|
||||
// Special properties are exposed on the local scope of each template instance, including:
|
||||
// $index, $first, $middle, $last, $even, $odd
|
||||
'ng-repeat'
|
||||
|
||||
// ngRequired adds the required validator to ngModel.
|
||||
// It is most often used for input and select controls, but can also be applied to custom controls.
|
||||
'ng-required'
|
||||
|
||||
// Sets the selected attribute on the element, if the expression inside ngSelected is truthy.
|
||||
'ng-selected'
|
||||
|
||||
// Shows or hides the given HTML element based on the expression provided to the ngShow attribute.
|
||||
'ng-show'
|
||||
|
||||
// Using AngularJS markup like {{hash}} in a src attribute doesn't work right:
|
||||
// The browser will fetch from the URL with the literal text {{hash}} until AngularJS
|
||||
// replaces the expression inside {{hash}}. The ngSrc directive solves this problem.
|
||||
'ng-src'
|
||||
|
||||
// Using AngularJS markup like {{hash}} in a srcset attribute doesn't work right:
|
||||
// The browser will fetch from the URL with the literal text {{hash}} until AngularJS
|
||||
// replaces the expression inside {{hash}}. The ngSrcset directive solves this problem.
|
||||
'ng-srcset'
|
||||
|
||||
// Allows you to set CSS style on an HTML element conditionally.
|
||||
'ng-style'
|
||||
|
||||
// Enables binding AngularJS expressions to onsubmit events.
|
||||
'ng-submit'
|
||||
|
||||
// Used to conditionally swap DOM structure on your template based on a scope expression.
|
||||
'ng-switch'
|
||||
|
||||
// Marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
|
||||
'ng-transclude'
|
||||
|
||||
// Binds the given expression to the value of the element.
|
||||
// It is mainly used on input[radio] and option elements, so that when the element is selected,
|
||||
// the ngModel of that element (or its select parent element) is set to the bound value.
|
||||
'ng-value'
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* NG MODULE > TYPE
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// A cache object used to store and retrieve data, primarily used by $templateRequest
|
||||
// and the script directive to cache templates and other data.
|
||||
$cacheFactory.Cache
|
||||
|
||||
// Don't forget the cache
|
||||
|
||||
// A shared object between directive compile / linking functions which contains normalized
|
||||
// DOM element attributes. The values reflect current binding state {{ }}.
|
||||
$compile.directive.Attributes
|
||||
|
||||
// Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with x- or data-)
|
||||
// to its normalized, camelCase form.
|
||||
$compile.directive.Attributes.$normalize(name)
|
||||
|
||||
// Adds the CSS class value specified by the classVal parameter to the element.
|
||||
// If animations are enabled then an animation will be triggered for the class addition.
|
||||
$compile.directive.Attributes.$addClass(classVal)
|
||||
|
||||
// Removes the CSS class value specified by the classVal parameter from the element.
|
||||
// If animations are enabled then an animation will be triggered for the class removal.
|
||||
$compile.directive.Attributes.$removeClass(classVal)
|
||||
|
||||
// Adds and removes the appropriate CSS class values to the element based on the difference
|
||||
// between the new and old CSS class values (specified as newClasses and oldClasses).
|
||||
$compile.directive.Attributes.$updateClass(newClasses, oldClasses)
|
||||
|
||||
// Observes an interpolated attribute.
|
||||
$compile.directive.Attributes.$observe(key, fn)
|
||||
|
||||
// Set DOM element attribute value.
|
||||
$compile.directive.Attributes.$set(name, value)
|
||||
|
||||
// A map of DOM element attribute names to the normalized name.
|
||||
// This is needed to do reverse lookup from normalized name back to actual name.
|
||||
$compile.directive.Attributes.$attr
|
||||
|
||||
// A root scope can be retrieved using the $rootScope key from the $injector.
|
||||
$rootScope.Scope([providers], [instanceCache])
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* NG MODULE > FILTERS
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Formats a number as a currency (ie $1,234.56).
|
||||
// When no currency symbol is provided, default symbol for current locale is used.
|
||||
{{ currency_expression | currency : symbol : fractionSize}}
|
||||
$filter('currency')(amount, symbol, fractionSize)
|
||||
|
||||
// Formats date to a string based on the requested format.
|
||||
{{ date_expression | date : format : timezone}}
|
||||
$filter('date')(date, format, timezone)
|
||||
|
||||
// Selects a subset of items from array and returns it as a new array.
|
||||
{{ filter_expression | filter : expression : comparator : anyPropertyKey}}
|
||||
$filter('filter')(array, expression, comparator, anyPropertyKey)
|
||||
|
||||
// Allows you to convert a JavaScript object into JSON string.
|
||||
// This filter is mostly useful for debugging.
|
||||
// When using the double curly notation the binding is automatically converted to JSON.
|
||||
{{ json_expression | json : spacing}}
|
||||
$filter('json')(object, spacing)
|
||||
|
||||
// Creates a new array or string containing only a specified number of elements.
|
||||
// The elements are taken from either the beginning or the end of the source array,
|
||||
// string or number, as specified by the value and sign (positive or negative) of limit.
|
||||
// Other array-like objects are also supported (e.g. array subclasses, NodeLists, jqLite/jQuery collections etc).
|
||||
// If a number is used as input, it is converted to a string.
|
||||
{{ limitTo_expression | limitTo : limit : begin}}
|
||||
$filter('limitTo')(input, limit, begin)
|
||||
|
||||
// Converts string to lowercase.
|
||||
{{ lowercase_expression | lowercase}}
|
||||
$filter('lowercase')()
|
||||
|
||||
// Formats a number as text.
|
||||
// If the input is null or undefined, it will just be returned.
|
||||
// If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively.
|
||||
// If the input is not a number an empty string is returned.
|
||||
{{ number_expression | number : fractionSize}}
|
||||
$filter('number')(number, fractionSize)
|
||||
|
||||
// Returns an array containing the items from the specified collection,
|
||||
// ordered by a comparator function based on the values computed using the expression predicate.
|
||||
{{ orderBy_expression | orderBy : expression : reverse : comparator}}
|
||||
$filter('orderBy')(collection, expression, reverse, comparator)
|
||||
|
||||
// Converts string to uppercase.
|
||||
{{ uppercase_expression | uppercase}}
|
||||
$filter('uppercase')()
|
339
frontend/react.js
vendored
Normal file
339
frontend/react.js
vendored
Normal file
@ -0,0 +1,339 @@
|
||||
/* *******************************************************************************************
|
||||
* REACT.JS CHEATSHEET
|
||||
* DOCUMENTATION: https://reactjs.org/docs/
|
||||
* FILE STRUCTURE: https://reactjs.org/docs/faq-structure.html
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
```
|
||||
npm install --save react // declarative and flexible JavaScript library for building UI
|
||||
npm install --save react-dom // serves as the entry point of the DOM-related rendering paths
|
||||
npm install --save prop-types // runtime type checking for React props and similar objects
|
||||
```
|
||||
|
||||
// notes: don't forget the command lines
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* REACT
|
||||
* https://reactjs.org/docs/react-api.html
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Create and return a new React element of the given type.
|
||||
// Code written with JSX will be converted to use React.createElement().
|
||||
// You will not typically invoke React.createElement() directly if you are using JSX.
|
||||
React.createElement(
|
||||
type,
|
||||
[props],
|
||||
[...children]
|
||||
)
|
||||
|
||||
// Clone and return a new React element using element as the starting point.
|
||||
// The resulting element will have the original element’s props with the new props merged in shallowly.
|
||||
React.cloneElement(
|
||||
element,
|
||||
[props],
|
||||
[...children]
|
||||
)
|
||||
|
||||
// Verifies the object is a React element. Returns true or false.
|
||||
React.isValidElement(object)
|
||||
|
||||
React.Children // provides utilities for dealing with the this.props.children opaque data structure.
|
||||
|
||||
// Invokes a function on every immediate child contained within children with this set to thisArg.
|
||||
React.Children.map(children, function[(thisArg)])
|
||||
|
||||
// Like React.Children.map() but does not return an array.
|
||||
React.Children.forEach(children, function[(thisArg)])
|
||||
|
||||
// Returns the total number of components in children,
|
||||
// equal to the number of times that a callback passed to map or forEach would be invoked.
|
||||
React.Children.count(children)
|
||||
|
||||
// Verifies that children has only one child (a React element) and returns it.
|
||||
// Otherwise this method throws an error.
|
||||
React.Children.only(children)
|
||||
|
||||
// Returns the children opaque data structure as a flat array with keys assigned to each child.
|
||||
// Useful if you want to manipulate collections of children in your render methods,
|
||||
// especially if you want to reorder or slice this.props.children before passing it down.
|
||||
React.Children.toArray(children)
|
||||
|
||||
// The React.Fragment component lets you return multiple elements in a render() method without creating an additional DOM element
|
||||
// You can also use it with the shorthand <></> syntax.
|
||||
React.Fragment
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* REACT.COMPONENT
|
||||
* React.Component is an abstract base class, so it rarely makes sense to refer to React.Component
|
||||
* directly. Instead, you will typically subclass it, and define at least a render() method.
|
||||
* https://reactjs.org/docs/react-component.html
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
class Component extends React.Component {
|
||||
// Will be called before it is mounted
|
||||
constructor(props) {
|
||||
// Call this method before any other statement
|
||||
// or this.props will be undefined in the constructor
|
||||
super(props);
|
||||
|
||||
// The constructor is also often used to bind event handlers to the class instance.
|
||||
// Binding makes sure the method has access to component attributes like this.props and this.state
|
||||
this.method = this.method.bind(this);
|
||||
|
||||
// The constructor is the right place to initialize state.
|
||||
this.state = {
|
||||
active: true,
|
||||
|
||||
// In rare cases, it’s okay to initialize state based on props.
|
||||
// This effectively “forks” the props and sets the state with the initial props.
|
||||
// If you “fork” props by using them for state, you might also want to implement componentWillReceiveProps(nextProps)
|
||||
// to keep the state up-to-date with them. But lifting state up is often easier and less bug-prone.
|
||||
color: props.initialColor
|
||||
};
|
||||
}
|
||||
|
||||
// Enqueues changes to the component state and
|
||||
// tells React that this component and its children need to be re-rendered with the updated state.
|
||||
// setState() does not always immediately update the component. It may batch or defer the update until later.
|
||||
// This makes reading this.state right after calling setState() a potential pitfall.
|
||||
// Instead, use componentDidUpdate or a setState callback.
|
||||
// You may optionally pass an object as the first argument to setState() instead of a function.
|
||||
setState(updater[, callback]) { }
|
||||
|
||||
// Invoked just before mounting occurs (before render())
|
||||
// This is the only lifecycle hook called on server rendering.
|
||||
componentWillMount() { }
|
||||
|
||||
// Invoked immediately after a component is mounted.
|
||||
// Initialization that requires DOM nodes should go here.
|
||||
// If you need to load data from a remote endpoint, this is a good place to instantiate the network request.
|
||||
// This method is a good place to set up any subscriptions. If you do that, don’t forget to unsubscribe in componentWillUnmount().
|
||||
componentDidMount() { }
|
||||
|
||||
// Invoked before a mounted component receives new props.
|
||||
// If you need to update the state in response to prop changes (for example, to reset it),
|
||||
// you may compare this.props and nextProps and perform state transitions using this.setState() in this method.
|
||||
componentWillReceiveProps(nextProps) { }
|
||||
|
||||
// Let React know if a component’s output is not affected by the current change in state or props.
|
||||
// The default behavior is to re-render on every state change, and in the vast majority of cases you should rely on the default behavior.
|
||||
// shouldComponentUpdate() is invoked before rendering when new props or state are being received. Defaults to true.
|
||||
// This method is not called for the initial render or when forceUpdate() is used.
|
||||
// Returning false does not prevent child components from re-rendering when their state changes.
|
||||
shouldComponentUpdate(nextProps, nextState) { }
|
||||
|
||||
// Invoked just before rendering when new props or state are being received.
|
||||
// Use this as an opportunity to perform preparation before an update occurs. This method is not called for the initial render.
|
||||
// Note that you cannot call this.setState() here; nor should you do anything else
|
||||
// (e.g. dispatch a Redux action) that would trigger an update to a React component before componentWillUpdate() returns.
|
||||
// If you need to update state in response to props changes, use componentWillReceiveProps() instead.
|
||||
componentWillUpdate(nextProps, nextState) { }
|
||||
|
||||
// Invoked immediately after updating occurs. This method is not called for the initial render.
|
||||
// Use this as an opportunity to operate on the DOM when the component has been updated.
|
||||
// This is also a good place to do network requests as long as you compare the current props to previous props (e.g. a network request may not be necessary if the props have not changed).
|
||||
componentDidUpdate(prevProps, prevState) { }
|
||||
|
||||
// Invoked immediately before a component is unmounted and destroyed.
|
||||
// Perform any necessary cleanup in this method, such as invalidating timers, canceling network requests,
|
||||
// or cleaning up any subscriptions that were created in componentDidMount().
|
||||
componentWillUnmount() { }
|
||||
|
||||
// Error boundaries are React components that catch JavaScript errors anywhere in their child component tree,
|
||||
// log those errors, and display a fallback UI instead of the component tree that crashed.
|
||||
// Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.
|
||||
componentDidCatch() { }
|
||||
|
||||
// This method is required.
|
||||
// It should be pure, meaning that it does not modify component state,
|
||||
// it returns the same result each time it’s invoked, and
|
||||
// it does not directly interact with the browser (use lifecycle methods for this)
|
||||
// It must return one of the following types: react elements, string and numbers, portals, null or booleans.
|
||||
render() {
|
||||
// Contains the props that were defined by the caller of this component.
|
||||
console.log(this.props);
|
||||
|
||||
// Contains data specific to this component that may change over time.
|
||||
// The state is user-defined, and it should be a plain JavaScript object.
|
||||
// If you don’t use it in render(), it shouldn’t be in the state.
|
||||
// For example, you can put timer IDs directly on the instance.
|
||||
// Never mutate this.state directly, as calling setState() afterwards may replace the mutation you made.
|
||||
// Treat this.state as if it were immutable.
|
||||
console.log(this.state);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Comment goes here */}
|
||||
Hello, {this.props.name}!
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Can be defined as a property on the component class itself, to set the default props for the class.
|
||||
// This is used for undefined props, but not for null props.
|
||||
Component.defaultProps = {
|
||||
color: 'blue'
|
||||
};
|
||||
|
||||
component = new Component();
|
||||
|
||||
// By default, when your component’s state or props change, your component will re-render.
|
||||
// If your render() method depends on some other data, you can tell React that the component needs re-rendering by calling forceUpdate().
|
||||
// Normally you should try to avoid all uses of forceUpdate() and only read from this.props and this.state in render().
|
||||
component.forceUpdate(callback)
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* REACT.DOM
|
||||
* The react-dom package provides DOM-specific methods that can be used at the top level of
|
||||
* your app and as an escape hatch to get outside of the React model if you need to.
|
||||
* Most of your components should not need to use this module.
|
||||
* https://reactjs.org/docs/react-dom.html
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Render a React element into the DOM in the supplied container and return a reference
|
||||
// to the component (or returns null for stateless components).
|
||||
ReactDOM.render(element, container[, callback])
|
||||
|
||||
// Same as render(), but is used to hydrate a container whose HTML contents were rendered
|
||||
// by ReactDOMServer. React will attempt to attach event listeners to the existing markup.
|
||||
ReactDOM.hydrate(element, container[, callback])
|
||||
|
||||
// Remove a mounted React component from the DOM and clean up its event handlers and state.
|
||||
// If no component was mounted in the container, calling this function does nothing.
|
||||
// Returns true if a component was unmounted and false if there was no component to unmount.
|
||||
ReactDOM.unmountComponentAtNode(container)
|
||||
|
||||
// If this component has been mounted into the DOM, this returns the corresponding native browser
|
||||
// DOM element. This method is useful for reading values out of the DOM, such as form field values
|
||||
// and performing DOM measurements. In most cases, you can attach a ref to the DOM node and avoid
|
||||
// using findDOMNode at all.
|
||||
ReactDOM.findDOMNode(component)
|
||||
|
||||
// Creates a portal. Portals provide a way to render children into a DOM node that exists outside
|
||||
// the hierarchy of the DOM component.
|
||||
ReactDOM.createPortal(child, container)
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* REACTDOMSERVER
|
||||
* The ReactDOMServer object enables you to render components to static markup.
|
||||
* https://reactjs.org/docs/react-dom.html
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
// Render a React element to its initial HTML. React will return an HTML string.
|
||||
// You can use this method to generate HTML on the server and send the markup down on the initial
|
||||
// request for faster page loads and to allow search engines to crawl your pages for SEO purposes.
|
||||
ReactDOMServer.renderToString(element)
|
||||
|
||||
// Similar to renderToString, except this doesn’t create extra DOM attributes that React uses
|
||||
// internally, such as data-reactroot. This is useful if you want to use React as a simple static
|
||||
// page generator, as stripping away the extra attributes can save some bytes.
|
||||
ReactDOMServer.renderToStaticMarkup(element)
|
||||
|
||||
// Render a React element to its initial HTML. Returns a Readable stream that outputs an HTML string.
|
||||
// The HTML output by this stream is exactly equal to what ReactDOMServer.renderToString would return.
|
||||
// You can use this method to generate HTML on the server and send the markup down on the initial
|
||||
// request for faster page loads and to allow search engines to crawl your pages for SEO purposes.
|
||||
ReactDOMServer.renderToNodeStream(element)
|
||||
|
||||
// Similar to renderToNodeStream, except this doesn’t create extra DOM attributes that React uses
|
||||
// internally, such as data-reactroot. This is useful if you want to use React as a simple static
|
||||
// page generator, as stripping away the extra attributes can save some bytes.
|
||||
ReactDOMServer.renderToStaticNodeStream(element)
|
||||
|
||||
|
||||
/* *******************************************************************************************
|
||||
* TYPECHECKING WITH PROPTYPES
|
||||
* https://reactjs.org/docs/typechecking-with-proptypes.html
|
||||
* ******************************************************************************************* */
|
||||
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
MyComponent.propTypes = {
|
||||
// You can declare that a prop is a specific JS type. By default, these
|
||||
// are all optional.
|
||||
optionalArray: PropTypes.array,
|
||||
optionalBool: PropTypes.bool,
|
||||
optionalFunc: PropTypes.func,
|
||||
optionalNumber: PropTypes.number,
|
||||
optionalObject: PropTypes.object,
|
||||
optionalString: PropTypes.string,
|
||||
optionalSymbol: PropTypes.symbol,
|
||||
|
||||
// Anything that can be rendered: numbers, strings, elements or an array
|
||||
// (or fragment) containing these types.
|
||||
optionalNode: PropTypes.node,
|
||||
|
||||
// A React element.
|
||||
optionalElement: PropTypes.element,
|
||||
|
||||
// You can also declare that a prop is an instance of a class. This uses
|
||||
// JS's instanceof operator.
|
||||
optionalMessage: PropTypes.instanceOf(Message),
|
||||
|
||||
// You can ensure that your prop is limited to specific values by treating
|
||||
// it as an enum.
|
||||
optionalEnum: PropTypes.oneOf(['News', 'Photos']),
|
||||
|
||||
// An object that could be one of many types
|
||||
optionalUnion: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.number,
|
||||
PropTypes.instanceOf(Message)
|
||||
]),
|
||||
|
||||
// An array of a certain type
|
||||
optionalArrayOf: PropTypes.arrayOf(PropTypes.number),
|
||||
|
||||
// An object with property values of a certain type
|
||||
optionalObjectOf: PropTypes.objectOf(PropTypes.number),
|
||||
|
||||
// An object taking on a particular shape
|
||||
optionalObjectWithShape: PropTypes.shape({
|
||||
color: PropTypes.string,
|
||||
fontSize: PropTypes.number
|
||||
}),
|
||||
|
||||
// You can chain any of the above with `isRequired` to make sure a warning
|
||||
// is shown if the prop isn't provided.
|
||||
requiredFunc: PropTypes.func.isRequired,
|
||||
|
||||
// A value of any data type
|
||||
requiredAny: PropTypes.any.isRequired,
|
||||
|
||||
// You can also specify a custom validator. It should return an Error
|
||||
// object if the validation fails. Don't `console.warn` or throw, as this
|
||||
// won't work inside `oneOfType`.
|
||||
customProp: function(props, propName, componentName) {
|
||||
if (!/matchme/.test(props[propName])) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Validation failed.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
// You can also supply a custom validator to `arrayOf` and `objectOf`.
|
||||
// It should return an Error object if the validation fails. The validator
|
||||
// will be called for each key in the array or object. The first two
|
||||
// arguments of the validator are the array or object itself, and the
|
||||
// current item's key.
|
||||
customArrayProp: PropTypes.arrayOf(function(propValue, key, componentName, location, propFullName) {
|
||||
if (!/matchme/.test(propValue[key])) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propFullName + '` supplied to' +
|
||||
' `' + componentName + '`. Validation failed.'
|
||||
);
|
||||
}
|
||||
})
|
||||
};
|
@ -233,7 +233,7 @@ str1 > str2 # str1 is greater than str2 (alphabetically)
|
||||
-e file # file exists; same -a
|
||||
-f file # file exists and is a regular file (i.e., not a directory or other special type of file)
|
||||
-r file # you have read permission
|
||||
-r file # file exists and is not empty
|
||||
-s file # file exists and is not empty
|
||||
-w file # your have write permission
|
||||
-x file # you have execute permission on file, or directory search permission if it is a directory
|
||||
-N file # file was modified since it was last read
|
||||
|
@ -20,6 +20,8 @@ docker login # Log in this CLI session using your
|
||||
docker tag <image> username/repository:tag # Tag <image> for upload to registry
|
||||
docker push username/repository:tag # Upload tagged image to registry
|
||||
docker run username/repository:tag # Run image from a registry
|
||||
docker system prune # Remove all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes. (Docker 17.06.1-ce and superior)
|
||||
docker system prune -a # Remove all unused containers, networks, images not just dangling ones (Docker 17.06.1-ce and superior)
|
||||
|
||||
|
||||
##############################################################################
|
||||
|
117
tools/kubernetes.sh
Normal file
117
tools/kubernetes.sh
Normal file
@ -0,0 +1,117 @@
|
||||
##############################################################################
|
||||
# KUBERNETES
|
||||
# PDF: https://sematext.com/kubernetes-cheat-sheet/
|
||||
# WEBSITE: https://kubernetes.io/
|
||||
# DOCUMENTATION: https://kubernetes.io/docs/home
|
||||
##############################################################################
|
||||
|
||||
|
||||
##############################################################################
|
||||
# CLIENT CONFIGURATION
|
||||
##############################################################################
|
||||
|
||||
|
||||
# Setup autocomplete in bash; bash-completion package should be installed first
|
||||
source <(kubectl completion bash)
|
||||
|
||||
# View Kubernetes config
|
||||
kubectl config view
|
||||
|
||||
# View specific config items by json path
|
||||
kubectl config view -o jsonpath='{.users[?(@.name == "k8s")].user.password}'
|
||||
|
||||
# Set credentials for foo.kuberntes.com
|
||||
kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword
|
||||
|
||||
|
||||
##############################################################################
|
||||
# VIEWING, FINDING RESOURCES
|
||||
##############################################################################
|
||||
|
||||
|
||||
# List all services in the namespace
|
||||
kubectl get services
|
||||
|
||||
# List all pods in all namespaces in wide format
|
||||
kubectl get pods -o wide --all-namespaces
|
||||
|
||||
# List all pods in json (or yaml) format
|
||||
kubectl get pods -o json
|
||||
|
||||
# Describe resource details (node, pod, svc)
|
||||
kubectl describe nodes my-node
|
||||
|
||||
# List services sorted by name
|
||||
kubectl get services --sort-by=.metadata.name
|
||||
|
||||
# List pods sorted by restart count
|
||||
kubectl get pods --sort-by='.status.containerStatuses[0].restartCount'
|
||||
|
||||
# Rolling update pods for frontend-v1
|
||||
kubectl rolling-update frontend-v1 -f frontend-v2.json
|
||||
|
||||
# Scale a replicaset named 'foo' to 3
|
||||
kubectl scale --replicas=3 rs/foo
|
||||
|
||||
# Scale a resource specified in "foo.yaml" to 3
|
||||
kubectl scale --replicas=3 -f foo.yaml
|
||||
|
||||
# Execute a command in every pod / replica
|
||||
for i in 0 1; do kubectl exec foo-$i -- sh -c 'echo $(hostname) > /usr/share/nginx/html/index.html'; done
|
||||
|
||||
|
||||
##############################################################################
|
||||
# MANAGE RESOURCES
|
||||
##############################################################################
|
||||
|
||||
|
||||
# Get documentation for pod or service
|
||||
kubectl explain pods,svc
|
||||
|
||||
# Create resource(s) like pods, services or daemonsets
|
||||
kubectl create -f ./my-manifest.yaml
|
||||
|
||||
# Apply a configuration to a resource
|
||||
kubectl apply -f ./my-manifest.yaml
|
||||
|
||||
# Start a single instance of Nginx
|
||||
kubectl run nginx --image=nginx
|
||||
|
||||
# Create a secret with several keys
|
||||
cat <<EOF | kubectl create -f -
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: mysecret
|
||||
type: Opaque
|
||||
data:
|
||||
password: $(echo "s33msi4" | base64)
|
||||
username: $(echo "jane"| base64)
|
||||
EOF
|
||||
|
||||
# Delete a resource
|
||||
kubectl delete -f ./my-manifest.yaml
|
||||
|
||||
|
||||
##############################################################################
|
||||
# MONITORING & LOGGING
|
||||
##############################################################################
|
||||
|
||||
|
||||
# Deploy Heapster from Github repository
|
||||
kubectl create -f deploy/kube-config/standalone/
|
||||
|
||||
# Show metrics for nodes
|
||||
kubectl top node
|
||||
|
||||
# Show metrics for pods
|
||||
kubectl top pod
|
||||
|
||||
# Show metrics for a given pod and its containers
|
||||
kubectl top pod pod_name --containers
|
||||
|
||||
# Dump pod logs (stdout)
|
||||
kubectl logs pod_name
|
||||
|
||||
# Stream pod container logs (stdout, multi-container case)
|
||||
kubectl logs -f pod_name -c my-container
|
Loading…
Reference in New Issue
Block a user