This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useState,useEffect} from 'react'; | |
import './App.css'; | |
import useDebounce from './useDebounce'; | |
function App() { | |
const [searchTerm,setSearchTerm] = useState(''); | |
const [data,setData] = useState([]); | |
const debouceSearchTerm = useDebounce(searchTerm, 300); | |
useEffect(() => { | |
if(debouceSearchTerm) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
const lastName string = "Kumar" | |
func main() { | |
fmt.Println("Constants") | |
const cardNumber = 2435353 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Variables") | |
// var firstName string = "Aditya" | |
// var firstName, lastName string = "Aditya", "Kumar" | |
// var isAuth bool = true // false | |
// var value int = 34 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ourVision = ["B$u$i$ld", "$t$$h$e", "N$e$x$t", "E$$ra", "$$o$f$", "S$$of$t$wa$r$e", "De$$ve$l$op$me$n$t"] | |
for(let i = 0; i < ourVision.length ; i++) { | |
ourVision[i] = ourVision[i].replaceAll('$',''); | |
} | |
console.log(ourVision.join(" ")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"math/rand" | |
"net/http" | |
"strconv" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose'); | |
const Schema = mongoose.Schema; | |
const postSchema = new Schema({ | |
title: { | |
type: String, | |
required: true, | |
}, | |
content: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const postRouter = require('./routes/postRoutes'); | |
const bodyParser = require('body-parser'); | |
const multer = require('multer'); | |
const {v4: uuidv4} = require('uuid'); | |
const dotenv = require('dotenv'); | |
const mongoose = require('mongoose'); | |
const userRouter = require('./routes/authRoutes'); | |
const path = require('path') | |
const app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Post = require("../models/Post"); | |
const { body, validationResult } = require("express-validator"); | |
const User = require("../models/User"); | |
const fs = require('fs'); | |
const path = require('path'); | |
exports.getAllPost = async (req, res, next) => { | |
try { | |
const post = await Post.find() | |
res.status(200).json({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const postController = require("../controllers/postController"); | |
const router = express.Router(); | |
const { body, validationResult } = require("express-validator"); | |
router.get( | |
"/", | |
postController.getAllPost | |
); | |
router.get('/:postId', postController.getPostById); |
NewerOlder