1. cd C:/mongodb/bin
2.mongod
Monday, 21 October 2013
Sunday, 20 October 2013
Creating a Node Express App
1. Write a package.json file which will contain the dependencies for the project. Place this in the root of the project.
{
"name": "NodeApp",
"description": "First Express app",
"version": "0.0.1",
"dependencies": {
"express": "3.x"
}
}
{
"name": "NodeApp",
"description": "First Express app",
"version": "0.0.1",
"dependencies": {
"express": "3.x"
}
}
2. In the command line navigate to the node project and run the following command.
npm install
3. Create you project folder and make a index.html file.
4. Write a 'app.js' file.
(function() {
//setup express
var express = require('express');
var app = express();
//add static folders
app.use("/js", express.static(__dirname + '/js'));
app.listen(3000);
app.get('/', function(request, response) {
response.sendfile('./index.html');
});
})();
5. In the command line navigate to the app.js file and run the following command.
node app.js
Subscribe to:
Posts (Atom)