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.
Install MongoDB if necessary (see http://docs.mongodb.org/manual/installation/ )
Ensure you have a clean directory to dedicate as to a database (e.g.
From this repository's imageboard directory, run the following command to launch the MongoDB process.
<MONGO_INSTALL_DIRECTORY>/bin/mongod --dbpath <PATH_TO_DB_DIRECTORY>
From this repository's imageboard directory, restore the sample app data to MongoDB in another command prompt with the following command:
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 installwill install this project's node dependencies from
tsd installwill retrieve
.d.tsfiles from DefinitelyTyped.
Compile the app with the following command:
The above command will use
tsconfig.jsonto compile all necessary files.
Launch the Node process to serve the app using the following command:
Open your favorite browser and navigating to
http://localhost:3000/to access the app.