Homework presentation Rapid Web Development with MongoDB and Node.js

Preview:

Citation preview

Homework presentationRapid Web Development with MongoDB and

Node.jsThe Bioinformatics Lab SS 2013 - Wiki topic 12

Tikira Temu

18. June 2013

Programming challenge

Mongodb

install MongoDB

command linesudo apt-get install mongodb

Get familiar with the shell (Tutorial [1])Add two documents to the collection ’students’

mongoDB shellmanu= name: ’manuel’, age: 24, courses: [’programming’, ’math’]tiki= name: ’tikira’, age: 25, courses: [’informatics’, ’neuroscience’]use biolabdb.students.insert(manu)db.students.insert(tiki)

Tikira Temu Rapid Web Development with MongoDB and Node.js 2

Programming challenge

NodeJS

install NodeJScommand linesudo apt-get install python g++ make checkinstallmkdir /src && cd $_wget -N http://nodejs.org/dist/node-latest.tar.gztar xzvf node-latest.tar.gz && cd node-v*./configurecheckinstall #(remove the "v" in front of the version number)sudo dpkg -i node_*

Tikira Temu Rapid Web Development with MongoDB and Node.js 3

Programming challenge

Install the modules express and mongoose

install modulescommand linesudo npm install expresssudo npm install mongoose

check installations

Tikira Temu Rapid Web Development with MongoDB and Node.js 4

Programming challenge

Define a mongoose model

Tikira Temu Rapid Web Development with MongoDB and Node.js 5

Programming challenge

Define a mongoose model

Tikira Temu Rapid Web Development with MongoDB and Node.js 6

Programming challenge

Create event bindings with express for the urls

Tikira Temu Rapid Web Development with MongoDB and Node.js 7

Programming challenge

Create event bindings with express for the urls

Tikira Temu Rapid Web Development with MongoDB and Node.js 8

Programming challenge

GET /list

Tikira Temu Rapid Web Development with MongoDB and Node.js 9

Programming challenge

GET /:id

Tikira Temu Rapid Web Development with MongoDB and Node.js 10

Programming challenge

GET /:id/xml

Tikira Temu Rapid Web Development with MongoDB and Node.js 11

Programming challenge

GET /:id/xml

Tikira Temu Rapid Web Development with MongoDB and Node.js 12

Programming challenge

GET /:id/xml

Command line (module installation)sudo npm install jsontoxml

Tikira Temu Rapid Web Development with MongoDB and Node.js 13

Programming challenge

GET /:id/edit

Tikira Temu Rapid Web Development with MongoDB and Node.js 14

Programming challenge

GET /:id/edit

Tikira Temu Rapid Web Development with MongoDB and Node.js 15

Programming challenge

GET /add

Tikira Temu Rapid Web Development with MongoDB and Node.js 16

Programming challenge

GET /add

Tikira Temu Rapid Web Development with MongoDB and Node.js 17

Programming challenge

GET /db

Tikira Temu Rapid Web Development with MongoDB and Node.js 18

Programming challenge

GET /db

Command line (module installation)sudo npm install mysql@2.0.0-alpha8

Tikira Temu Rapid Web Development with MongoDB and Node.js 19

Programming challenge

Add a field visitors in the Student model and count eachtime the /:id page of a student is requested

Tikira Temu Rapid Web Development with MongoDB and Node.js 20

Programming challenge

References

[1] MongoDB Tutorial[2] jsontoxml[3] module: jstoxml[4] module: felixge / node-mysql

Tikira Temu Rapid Web Development with MongoDB and Node.js 21

Programming challenge

for your attention!

Tikira Temu Rapid Web Development with MongoDB and Node.js 22

Recommended