### Start the application using npm Source: https://roadmap.sh/guides/session-based-authentication This snippet demonstrates the command used in a shell environment to start the application after configuring the 'start' script in package.json. It utilizes npm's run-script functionality. ```shell npm run start ``` -------------------------------- ### Install snapd and Certbot for SSL Source: https://roadmap.sh/guides/setup-and-auto-renew-ssl-certificates Installs the snapd package manager and Certbot, a tool for obtaining and renewing SSL certificates. This process requires root privileges and is specific to Debian-based systems like Ubuntu. ```shell sudo apt-get update sudo apt-get install snapd sudo snap install core; snap refresh core sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot certbot --version ``` -------------------------------- ### Summarized Steps for SSH Agent Forwarding Source: https://roadmap.sh/guides/how-to-setup-a-jump-server A concise summary of the commands required to set up SSH agent forwarding, focusing on adding the private key to the local SSH agent. ```bash # Add the private key to the local SSH agent ssh-add ~/.ssh/mykey.pem ``` -------------------------------- ### Obtain SSL Certificate with Certbot (Nginx/Apache) Source: https://roadmap.sh/guides/setup-and-auto-renew-ssl-certificates Obtains and installs an SSL certificate for a specified domain using Certbot. It can be run interactively or non-interactively for automation. Requires root privileges and depends on Certbot being installed. ```shell # For Nginx: sudo certbot --nginx # For Apache: sudo certbot --apache # Non-interactive example for Apache: sudo certbot --apache \ --agree-tos \ -m you@email.com \ --no-eff-email \ --redirect \ --domains news.roadmap.sh ``` -------------------------------- ### Initialize Go Project and Install Dependencies Source: https://roadmap.sh/golang/rest-api This snippet demonstrates setting up a new Go project directory, initializing it with a Go module, and installing necessary dependencies like Gin, Gorm with PostgreSQL and SQLite drivers, and godotenv. ```bash mkdir go_book_api && cd go_book_api go mod init go_book_api go get -u github.com/gin-gonic/gin go get -u gorm.io/gorm go get -u gorm.io/driver/postgres go get -u gorm.io/driver/sqlite go get -u github.com/joho/godotenv ``` -------------------------------- ### Run PostgreSQL Docker Container Source: https://roadmap.sh/guides/single-command-database-setup This command starts a PostgreSQL database in a detached Docker container, exposing port 5432 and setting the 'admin' password. It's a straightforward way to get a PostgreSQL instance running for development. ```bash docker run \ --name pg \ --detach \ --publish 5432:5432 \ --env POSTGRES_PASSWORD=admin \ postgres ``` -------------------------------- ### Manual Ansible Deployment for Node.js Service Source: https://roadmap.sh/projects/nodejs-service-deployment This task involves creating an Ansible role to deploy a Node.js application. It clones the repository, installs dependencies, builds the application, and starts the service on port 80. This requires an existing Ansible setup and a Node.js service codebase. ```bash ansible-playbook node_service.yml --tags app ``` -------------------------------- ### Initialize Node.js Project and Create Directory Source: https://roadmap.sh/guides/session-based-authentication Commands to set up a new Node.js project. First, it creates a directory for the application, and then it initializes a package.json file using npm init. ```shell mkdir session-auth-example cd session-auth-example npm init -y ``` -------------------------------- ### Go Application Entry Point and Routes Source: https://roadmap.sh/golang/rest-api This Go code sets up the main application entry point using the Gin framework. It initializes the database, defines the REST API routes for book creation, retrieval, update, and deletion, and starts the server on port 8080. Dependencies include the 'gin-gonic/gin' and 'go_book_api/api' packages. ```go package main import ( "github.com/gin-gonic/gin" "go_book_api/api" ) func main() { api.InitDB() r := gin.Default() //routes r.POST("/book", api.CreateBook) r.GET("/books", api.GetBooks) r.GET("/book/:id", api.GetBook) r.PUT("/book/:id", api.UpdateBook) r.DELETE("/book/:id", api.DeleteBook) r.Run(":8080") } ``` -------------------------------- ### Go Function Call Example Source: https://roadmap.sh/questions/golang Provides a basic example of calling a function in Go. It shows a simple function 'greet' that takes a string parameter and returns a greeting, demonstrating parameter passing by value and function invocation. ```go package main import "fmt" func greet(name string) string { return "Hello, " + name + "!" } func main() { // Here we call the function. message := greet("Bob") fmt.Println(message) } ``` -------------------------------- ### HTTP/0.9 GET Request Example Source: https://roadmap.sh/guides/journey-to-http2 Illustrates the simplest form of an HTTP request, used in HTTP/0.9. This request only specifies the GET method and the resource path, with no headers or version information. ```html GET /index.html ``` -------------------------------- ### Basic SQL Query Example Source: https://roadmap.sh/sql/how-long-to-learn Demonstrates the use of fundamental SQL commands like SELECT, WHERE, and ORDER BY to retrieve and filter data. This is useful for generating quick insights and auditing performance. ```sql SELECT column1, column2 FROM your_table WHERE condition ORDER BY column1; ```