DevTech101

DevTech101

Month: August 2015

NodeJS and mongoose

npm install mongoose app.js var express = require(‘express’); var os = require(‘os’); // Mongoose import var mongoose = require(‘mongoose’); // Mongoose connection to MongoDB (ted/ted is readonly) mongoose.connect(‘mongodb://127.0.0.1/users’, function (error) { if (error) { console.log(error); } }); // Mongoose Schema definition var Schema = mongoose.Schema; var UserSchema = new Schema({ hostname: String, loadavrg: String, totalmem: …

NodeJS and mongoose Read More »

Using NodeJS With MongoDB

Configuring MongoDB First test and connect to mongo From connect line > use mcfly switched to db mcfly > db.createCollection(‘mathpeeps’) { “ok” : 1 } > db.mathpeeps.insert({Firstname: ‘Eli’, lastname: ‘Kleinman’}) WriteResult({ “nInserted” : 1 }) > db.mathpeeps.insert({Firstname: ‘Moshe’, lastname: ‘Kleinman’}) WriteResult({ “nInserted” : 1 }) > db.mathpeeps.find() { “_id” : ObjectId(“55ce19e7737e49e3a5a7553e”), “Firstname” : “Eli”, “lastname” …

Using NodeJS With MongoDB Read More »

Node JS and express

Bootstrap + nodejs http://lresende.blogspot.com/2015/01/nodejs-building-html-site-template.html Express using EJS (not jade the default) express –ejs node_app2 In the Views > headers.ejs In the index.ejs Hello, world! This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point …

Node JS and express Read More »