A beginner-friendly guide to setting up PostgreSQL replication with 1 primary and 2 replicas using Docker.
100+ open-source clones and alternatives of popular sites like Airbnb, Amazon, Instagram, Netflix, TikTok, Spotify, WhatsApp, YouTube, etc. List contains source code, tutorials, demo links, tech stack, and GitHub stars count. Great for learning purpose!
-Made by Gourav Goyal
See full tables with better view 👉 gourav.io/clone-wars
Self-hosting is the practice of hosting and managing applications on your own server(s) instead of consuming from SaaSS providers.
This is a list of Free Software network services and web applications which can be hosted on your own server(s). Non-Free software is listed on the [Non-Free](https://github.com/awesome
You may want to install PostgreSQL from an official repository, since it is updated more frequently than official Ubuntu sources.
First, you should install prerequisite software packages that will be used to download and install software certificates for a secure SSL connection.
sudo apt install wget ca-certificates
Then, get the certificate, add it to apt-key management utility and create a new configuration file with an official PostgreSQL repository address inside.
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
It is always a good idea to download information about all packages available for installation from your configured sources before the actual installation.
| const actionTypes = { | |
| toggle: 'TOGGLE', | |
| on: 'ON', | |
| off: 'OFF', | |
| } | |
| function toggleReducer(state, action) { | |
| switch (action.type) { | |
| case actionTypes.toggle: { | |
| return {on: !state.on} |
| import { createContext, useContext, useReducer } from 'react'; | |
| const MyContext = createContext(); | |
| myContext.displayName = 'MyContext'; | |
| const MyContextProvider = ({ initialState = {}, ...props }) => { | |
| const [state, dispatch] = useReducer( | |
| (state, action) => { | |
| switch (action?.type) { | |
| case 'MYTYPE' : { |
| import axios from 'axios'; | |
| const MakeApiRequest = axios.create({ | |
| baseURL: "https://jsonplaceholder.typicode.com/", | |
| headers: { 'Accept': 'application/json' }, | |
| timeout: 10000, | |
| }); | |
| const setAuthToken = (token = '') => { | |
| if (token) { |
| import axios from "axios"; | |
| export default (history = null) => { | |
| const baseURL = process.env.REACT_APP_BACKEND_URL; | |
| let headers = {}; | |
| if (localStorage.token) { | |
| headers.Authorization = `Bearer ${localStorage.token}`; |
| import axios, { CancelTokenSource } from 'axios'; | |
| import { useState, useEffect } from 'react'; | |
| import { PostInterface, defaultPostInterface } from './models/postInterface'; | |
| const App = () => { | |
| /* | |
| const [getVariableName, setValueVariableFunction] : [getVariableName_type, (setValueVariableFunction: setValueVariableFunction_type) => setValueVariableFunction_return_type] = useState<variable_type>(variableDefaultValue); | |
| */ | |
| const [posts, setPosts]: [PostInterface[], (posts: PostInterface[]) => void] = useState(defaultPostInterface); | |
| const [loading, toggleLoading]: [boolean, (loading: boolean) => void] = useState<boolean>(true); |

