Skip to content

Instantly share code, notes, and snippets.

View BunHouth's full-sized avatar
🎯
Focusing

Bunhouth BunHouth

🎯
Focusing
  • Remote Work
  • Phnom Penh
  • 11:28 (UTC +07:00)
  • X @bunhouth
View GitHub Profile

API

The URL pattern for an API is generally structured to make it easy to understand the purpose and hierarchy of the resources being accessed. Here are some common best practices for designing API URL patterns:

1. Resource-Based URLs:

  • Use nouns to represent resources.
  • Example: /api/v1/users, /api/v1/orders, /api/v1/products.

2. HTTP Methods for Actions:

  • Use HTTP methods to specify actions (GET, POST, PUT, DELETE).

Setup Server Step

Step 1

make sure change count base on machine RAM

sudo apt-get -y update
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=2048
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1

Swap RAM

sudo fallocate -l 32G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
free -h
sudo cp /etc/fstab /etc/fstab.bak
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e"
integrity sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==
dependencies:
"@babel/highlight" "^7.8.3"
{
"name": "RNVideoProcessingDemo",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
import React, {useState} from 'react';
import RNFetchBlob from 'rn-fetch-blob'
import {
FlatList,
SafeAreaView,
StyleSheet,
Text,
TouchableOpacity,
View,
} from 'react-native';
import messaging from '@react-native-firebase/messaging';
import PushNotification from 'react-native-push-notification';
import PushNotificationIOS from '@react-native-community/push-notification-ios';
import { navigate } from '@navigator/navigator';
import { registerDeviceToken } from '@state/auth/ActionCreator';
export const notificationHandler = data => {
if (data?.notify_type === 'comment') {
navigate('PostDetail', {
postId: data.target_id,
- title nil
- meta_description nil
= render partial: 'shared/header', locals: { search_bar: false, fixed_top: false }
.container
%h1.booking-header
= t('.book_no_pay_later')
.row
class SearchController < FrontendController
def index
@locations = locations
@search = Search.new(params, current_guest)
result = @search.paginate
respond_to do |format|
@data = { data: @search.search_results, total_count: @search.paginate[:total_count], total_pages: @search.paginate[:total_pages], per_page: 20, page: params[:page]}
query_params = params.except(:controller, :action, :search, :query).as_json