Skip to content

Latest commit

 

History

History
73 lines (61 loc) · 1.81 KB

readme.md

File metadata and controls

73 lines (61 loc) · 1.81 KB

Professional Backend Project

All about the configuration needed before the start of a backend project.

  • Check models link: - focus on Users

Let's Code

  • Make a folder chaibackend

    • intialise Node by npm init
    • keep the default
  • Add readme.md and add to github

  • $Protip💡$: Images stored at Third Party service like AWS , Azure , Cloudnary

    • temporaly stored at server ; so as if connection is lost ; user dont have to upload again
  • $Protip💡$: Git can track empty folder so add .gitkeep works opposite to .gitignore

  • Make folder public and folder temp in it , add .gitkeep inside temp

  • Make .gitignore at root directory

    • gitignore generator ; search in browser link and search for node
    • copy paste in .gitignore
  • Make .env at root directory

  • Make src folder at root directory

  • three files : app.js; index.js; constants.js

  • change in package.json "type" : "module",

  • Reload if change in index.js

    • by --watch ; new Node feature
    • by nodemon ; followed here
      • install by npm i -D nodemon
      • -D symbolises dev dependency instead of main dependency ; check docs official for more
    • change in script.js
"Scripts" : {
   "dev" : "nodeman src/index.js"
}
  • update github

  • Make folders in src folder

    • controllers
    • db
    • middleware
    • models
    • routes
    • utils
  • $Protip💡$: Adding prettier plugin for an organised format

    • npm i -D prettier
    • Make two files
      • .prettierrc : holds configuration
{
  "trailingComma": "es5",
  "tabWidth": 2,
  "semi": true,
  "singleQuote": true ,
  "bracketSpacing" : true 
}
  • .prettierignore
*.env
.env
.env.*
/.vscode
/node_modules
./dist