Skip to content

An example project with TypeScript, Babel and Express for connecting to an SMB shared directory.

License

Notifications You must be signed in to change notification settings

drubetti/TypeScript-Express-SMB-Starter

Repository files navigation

TypeScript-Express-SMB-Starter

Description

An example project with TypeScript, Babel and Express for connecting to an SMB shared directory.

Requirements

  • smbclient (on Linux) or Docker (on macOS/Windows)
  • Node.js

Setup

npm i

Static Type Check

npm run type-check

Run Tests

npm t

Build JavaScript code

npm run build:js

Built code will be put in dist folder.

Start App (AOT compilation)

Build JavaScript code, then run:

node dist

Start App (on-the-fly compilation)

npm start

Start App in Docker (AOT compilation)

Build the Docker image:

npm run docker-build

Once the image is built, run:

npm run docker-start

The Docker image must be rebuilt on code changes!

Start App in Docker (on-the-fly compilation)

Build the Docker image:

npm run docker-build-dev

Once the image is built, run:

npm run docker-start-dev

or (for "watch" mode):

npm run docker-watch

The Docker image can be reused on code changes (the repository is mounted as a volume).

Start bash in Docker

Build the Docker image:

npm run docker-build-dev

Once the image is built, run:

npm run docker-bash

Start bash in Docker and mount SMB shared storage as a volume

Build the Docker image:

npm run docker-build-dev

Once the image is built, run:

npm run docker-start-privileged-dev

That will run the Docker image with the --privileged option, needed when mounting remote file systems in containers.

Then, mount SMB storage by executing mountSMBfs.sh script (set environment variables first, see .env.sample):

sh mountSMBfs.sh

SMB storage will be mounted to /mnt/smbstorage.