Skip to content

Instantly share code, notes, and snippets.


Rajitha Gunathilake RizkyRajitha

View GitHub Profile
View forloop.js
var arr1 = [1, 2, 3, 4];
var arr2 = [7, 8, 9, 1];
loop1: for (let element1 of arr1) {//define a breakpoint
for (let element2 of arr2) {
console.log(element1, " ", element2);
if (element1 === element2) {
console.log("duplicate numbers");
break loop1;//if a specific condition is met , break the loop
View promiseall.js
var files = req.files;
var promisarr = [];//initialize promises array
function multiplefiles3(resobj) {
var params = {
Bucket: "******",
Key: resobj.originalname,
Body: resobj.buffer
return s3bucket.upload(params).promise();
View supplyAd.js
const express = require("express");
var router = express.Router();
var ObjectId = require("mongoose").Types.ObjectId;
var { SupplyAd } = require("../models/supplyAd");
router.get("/", (req, res) => {
eDate: {
// mechchrai aulthen dmme
View dropdaownnavbar.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />

1 . appwrite only for testing purpose only , after devoloping the frontend we can wire it with our own backend . am i correct

2 .i dont understand that, how to handle my requiest . like lets say i want to make a login which is backed by appwrite self hosted server . what i usually do is make a post request to my backend server and the i will get the payload , base on that payload i can decide wheather to log this user or not

something like

View home.svelte
import axios from "axios";
const appid_openweather = "ac0fdd38df429674be21355a4850114b"; //openweathermap appid
const appid_heremaps = "lmuiUmhDK2JQwBnORnRB"; //here maps appid
const appcode_heremaps = "W3YBbdzlsKOER9SvMF_V1g"; //here maps app code
var loading = false; //get loading state varialble
var city = ""; //store input value varialble1
var temp = ""; //store temp varialble
var humidity = ""; //store humidity varialble
View app.svelte
import Home from "./home.svelte";//importing app component from home.svelt
<Home />
View client.js
//import all the dependencies
const prompt = require("prompt");
const { ChatManager, TokenProvider } = require("@pusher/chatkit-client");
const axios = require("axios");
const { JSDOM } = require("jsdom");
const readline = require("readline");
const ora = require('ora');
const spinner = ora()
View server.js
//import all the dependencies
const chatkit = require("@pusher/chatkit-server");
const express = require("express");
const bp = require("body-parser");
const cors = require("cors");
//make our server
const app = express();
//enable cors
//enable body parser
View registration
import React, { Component } from "react";
import jsonwebtoken from "jsonwebtoken";
import { Redirect } from "react-router-dom";
import axios from "axios";
class Register extends Component {
state = {
email: "",