Code Monkey home page Code Monkey logo

blog-server's Introduction

The Backend code of the YouTube Series Blog app development from scratch using (Flutter, ExpressJS, NodeJS, MongoDB, Heroku, MongoDB Atlas) ๐Ÿ˜„ .

The YouTube Channle Link -: Channle link

Mian Youtube Playlist Link-: Playlist Link

Only Backend Development part playlist -: Playlist Link

Rest API Documenatation Link

Before going to code make sure to install mongoDB database on your local system ๐Ÿ˜… .For installing mongoDB you can take help from the This video .For this project I am using the Mongoose.

Below are the some basic syntax for your help after installing the mongoDB.

  • For starting the server

    sudo service mongod start

  • For stoping the server

    sudo service mongod stop

  • For restarting the server

    sudo service mongod restart

Note -:Above codes are valid for linux only.For windows user can follow this link ๐Ÿ˜‰

Fork this repository and then clone it because after forking it you will be updated if i will change the code here:wink:

Back End Code folder structure

  • model
    • All Mongoose model schemas
  • routes
    • All end points codes are here(routes folder)
  • index.js file (main Source file)
  • middleware.js (middleware for token validation)
  • config.js(helper function for middleware.js file)

Get the code

  1. Fork this repository
  2. Then create a new folder on you local system, where you want to keep the code.
  3. Create an empty git repository on that folder.

    git init

  4. Copy your forked GitHub repository url
  5. Now pull the code on yoor system

    git pull origin master

Or, else just clone this repository ๐Ÿ˜…

1) To run the Rest Server on local system folow this steps-:

  1. For installing all the necessary npm packages-

$ npm install

2.Now,the app is connected to the local mongoDb databse .You must start the mongoDb server before running the backend server .

sudo service mongod start

  1. Below given,is the code of connecting the mongoDB with nodeJs (index.js file) for more details you can follow this video Link for more information-:
mongoose.connect("mongodb://localhost:27017/blogDB", {
  useNewUrlParser: true,
  useCreateIndex: true,
});
  1. Start the server by using below code

$ npm run dev

  1. It will launch the server on http://localhost:5000 this url. This localhost url is a base url you will need this while connecting your rest server with flutter app

If suppose at the same time working with Flutter , Node/Express, and MongoDB your system will be hang them you can host this rest server on heroku cloud(free). So you only need to bother about the flutter code.

2) Remote Rest server setup

  1. First you have to host your MongoDB database on MongoDb Atlas server(Free), for that follow this video link
  2. Then deploy your NodeJs Rest Server on Heroku, for that follow this video link
  3. After that heroku will genrate a final endponits(url). That url will be base url for our flutter app.

3) Alternatively here is my base url for my flutter blog app. You can use it if you find any difficulty on above methods.

Note-: If many person will use this url then there will be chance that my free hosting on MongoDB Atlas server exhausted. At that time I will delete some data from the server ๐Ÿ˜…. So my humbel request is to craete your own dedicated rest server ๐Ÿ˜….

Link- https://sheltered-waters-80365.herokuapp.com/

Note -: Make sure you Subscribed my YouTube channle also give star to this repository ๐Ÿ˜…

blog-server's People

Contributors

dependabot[bot] avatar devstack06 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.