Skip to content

Using Typescript to create A Node/Express Application with MongoDB Connection, CSV Import/Export & Docker Container

Notifications You must be signed in to change notification settings

torredefarol24/nodeTSMongo

Repository files navigation

TypeScript with Node & MongoDB

  • Backend - Express (written in TypeScript)
  • Frontend - Pug Templating Engine
  • Database - MongoDB + Mongoose (ORM)
  • FrontendDesign - Zurb Foundation
  • CSV Libs - JSON2CSV, CSV2JSON
  • File Upload - Multer --Awesome Library!

Run Docker Container

$ cd nodeTSMongo
$ docker pull burningraven06/node-ts-mongo
$ docker-compose up

Run App Locally

  • Create DB Config
$ cd nodeTSMongo
$ touch src/config/keys.ts
  • Update src/config/keys.ts
const AppKeys = {
  mongoDBURL : <YOUR_MONGODB_URL>,
  mongoDBDockerURL : ""
}

export default AppKeys
  • Update src/hostApp.ts
$ cd nodeTsMongo/src/   #Open hostApp.ts

# Change Line 19
public mongoURL : string = AppKeys.mongoDBDockerURL

# to 
public mongoURL : string = AppKeys.mongoDBURL
  • Install Package Dependencies
$ cd nodeTSMongo
$ yarn install

#Or, with npm
$ npm install
  • Run App in DEV Mode
$ cd nodeTSMongo
$ yarn watch-ts
$ yarn watch-js
  • Run App in PROD Mode
$ cd nodeTSMongo
$ yarn run production