jd-apprentice / Node-TS

πŸ“ Template -> NodeJS + Typescript + Express + Mongodb + Mongoose + Heroku

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸƒβ€β™‚οΈ Run project locally

>> npm i -g yarn

>> git clone https://github.com/jd-apprentice/Node-TS.git

>> cd ./Node-TS

>> yarn install

>> yarn dev

πŸ§ͺ Test locally

- These are the routes with insomnia

>> GET {{ _.BASE_URL }}/users

>> POST {{ _.BASE_URL }}/users

>> GET {{ _.BASE_URL }}/users/:id

>> DELETE {{ _.BASE_URL }}/users/:id

>> PUT {{ _.BASE_URL }}/users/:id
  • Create CREATE
  • Find USERS
  • FindOne USER
  • Update PUT
  • Delete DELETE

πŸ‡ Heroku deploy

DASHBOARD

  • Once there create a new app

NEWAPP

  • Go to the settings page and select buildpacks then choose nodejs

BUILDPACK

  • After that you can go into deploys and deploy the app, for this method you have multiple options I often use github

DEPLOY

  • And below that there is the option for automatic deploys (when you push something to your selected branch ej main it will automatically deploy to heroku)

ADEPLOY

  • And for last if u haven't done already there is the manual deploy where you select the branch and deploy the app

MANUAL

🏁 Finish

  • And we are done! if everything was done correctly your app should be up and running on heroku, you can check it in the Open App button on their dashboard

  • Here are some example apps i've build in the past with this structure

  • A simple crud app CRUD-BE

  • Get news from Infobae Infobae-API

  • Get random waifus Waifuland

πŸ“‚ Folder structure

|--> @types
|--> config
|--> controllers
    >user-controller.ts
|--> models
    |--> interfaces
    >user.ts
|--> repositories
    >user-repository.ts
|--> routes
    >user-route.ts
    >index.ts
|--> services
    >user-service.ts
>database.ts (Connection with the database)
>index.ts (Run the app)
>server.ts (App instance)

πŸ“š Stack & Technologies

  • Nodejs
  • Typescript
  • Express
  • Mongodb
  • Mongoose
  • Heroku

About

πŸ“ Template -> NodeJS + Typescript + Express + Mongodb + Mongoose + Heroku

License:MIT License


Languages

Language:TypeScript 99.5%Language:Shell 0.5%