Find file History
Latest commit 69d9f30 Jul 19, 2016 @timothy timothy findOne is deprecated. Changed findOne instances to .batchSize(10).ne…
…xtObject() in order to ovoid negative externalities of rare corner cases.

TypeScript Sample: Image Board


This sample implements a complete Node.js application. Notable features:

  • Typed usage of express for server side MVC
  • Typed usage of mongodb for server side database
  • Typed usage of Node.js
  • Use of external typings from DefinitelyTyped
  • Visual Studio project file for working with the project


Note: All commands entered need to be performed from within this directory.

  1. Install MongoDB if necessary (see )

  2. Ensure you have a clean directory to dedicate as to a database (e.g. C:\imageboard or ~/imageboard/).

  3. From this repository's imageboard directory, run the following command to launch the MongoDB process.

  4. From this repository's imageboard directory, restore the sample app data to MongoDB in another command prompt with the following command:

    <MONGO_INSTALL_DIRECTORY>/bin/mongorestore dump
  5. From this imageboard directory, install the app's node dependencies, tsd, and typings with the following commands:

    npm install
    npm install -g tsd
    tsd install

    Some things to note:

    • npm install will install this project's node dependencies from package.json.
    • tsd install will retrieve .d.ts files from DefinitelyTyped.
  6. Compile the app with the following command:


    The above command will use tsconfig.json to compile all necessary files.

  7. Launch the Node process to serve the app using the following command:

    node app.js
  8. Open your favorite browser and navigating to http://localhost:3000/ to access the app.