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 TypeScript module syntax
- Visual Studio project file for working with the project
Note: Perform steps 3 - 6 with your working directory set to the folder containing this README.md file:
-
Install MongoDB if necessary (see http://docs.mongodb.org/manual/installation/ )
-
Ensure MongoDB is running, e.g.: by launching it manually:
<mongoinstalldir>\bin\mongod
-
Restore the sample app data to MongoDB in another command prompt with the following command:
<mongoinstalldir>\bin\mongorestore dump
-
Install the app's node dependencies with the following command:
npm install
-
After ensuring that
tsd
is available globally (npm install -g tsd
), install the typings with the following command:tsd install
-
Compile the app with the following command:
tsc --sourcemap --module commonjs app.ts
-
Launch the Node process to serve the app using the following command:
node app.js
-
Open your favorite browser and going to the following URL to access the app:
http://localhost:3000/