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.
C:\imageboard
or~/imageboard/
). -
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:
<MONGO_INSTALL_DIRECTORY>/bin/mongorestore dump
-
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 frompackage.json
.tsd install
will retrieve.d.ts
files from DefinitelyTyped.
-
Compile the app with the following command:
tsc
The above command will use
tsconfig.json
to compile all necessary files. -
Launch the Node process to serve the app using the following command:
node app.js
-
Open your favorite browser and navigating to
http://localhost:3000/
to access the app.