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 from 'react' | |
import { configureStore, applyMiddleware, compose } from '@reduxjs/toolkit' | |
import rootReducer from './reducers/rootReducer'; | |
import { composeWithDevTools } from 'redux-devtools-extension' | |
import firebase from './../config' | |
import { createFirestoreInstance, getFirestore } from 'redux-firestore' | |
import thunk from 'redux-thunk'; | |
import { getFirebase } from 'react-redux-firebase' | |
import _ from "lodash"; |
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 app = express(); | |
const mongoose = require('mongoose'); | |
app.use(express.json()); | |
app.listen(3000); | |
const userRouter = express.Router(); | |
//Provide me the base url and the mini app that I will use. | |
//base Route, RouterToUse |
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 { ObjectId } = require('mongodb'); | |
const {connectToDb, getDb} = require('./db'); | |
//Initiate app and middleware | |
const app = express(); | |
app.use(express.json()) | |
//db connection | |
let db; |
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 { MongoClient } = require("mongodb"); | |
const uri = "mongodb://localhost:27017/Bookstore" | |
let dbConnection; | |
const getDb = ()=>dbConnection | |
const connectToDb = async(cb)=>{ | |
MongoClient.connect(uri) |
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 app = express(); | |
app.listen(3000); | |
app.use(express.json()); //global middleware | |
const authRouter = express.Router(); | |
//On this base route usi this router | |
app.use('/auth', authRouter); //global middleware |
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') | |
//app is an instance of express. | |
const app = express(); | |
//Middleware function --> converts data coming from frontend to json | |
app.use(express.json()) | |
app.listen(3000); | |
let users = [ | |
{ |
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 app = express(); | |
app.listen(3000); | |
const express = require('express'); | |
const app = express(); | |
app.listen(3000); | |
//sending response using express | |
app.get('/about', (req, res)=>{ |
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
//Taking out http module from node | |
const http = require('htttp') | |
const fs = require('fs') | |
//Making the server | |
const server = http.createServer((req, res)=>{ | |
//we can send response from our server like this | |
res.setHeader('Content-Type', 'text/html'); | |
res.write(<h1>Wohoo! Server is running</h1>); | |
res.end(); | |