-
Notifications
You must be signed in to change notification settings - Fork 2
How to run it
camposer edited this page Jul 26, 2012
·
5 revisions
For create the application I installed node.js and its package manager npm. For doing that I just typed:
$ sudo aptitude install nodejs npm
My actual linux installation (obsolete):
$ cat /etc/issue Ubuntu 10.10 \n \l
My actual node.js packages are:
$ dpkg -l node\* npm ... ii nodejs 0.8.2-1chl1~maverick1 Node.js event-based server-side javascript engine ii nodejs-dev 0.8.2-1chl1~maverick1 Development files for Node.js ii npm 1.1.39-1chl1~maverick1 package manager for nodejs
Note: If you want to install an specific version, you can do it directly from the sources
$ git clone https://github.com/camposer/express-examples.git
$ cd express-examples $ cd sqlite $ node app Express server listening on port 3000
Just enter in your browser: http://localhost:3000
You can test the REST services directly using CURL (installing it is as simple as enter: sudo aptitude install curl). Inside the app there is a script named curltest.sh.
echo "getUsers" curl -X GET http://localhost:3000/rest/users; echo echo "getUserById" curl -X GET http://localhost:3000/rest/users/1; echo echo "addUser" curl -X PUT -H "Content-type:application/x-www-form-urlencoded" -d "name=rodolfo" http://localhost:3000/rest/users; echo echo "updateUser" curl -X POST -H "Content-type:application/x-www-form-urlencoded" -d "id=1&name=juan" http://localhost:3000/rest/users; echo echo "deleteUser" curl -X DELETE -H "Content-type:application/x-www-form-urlencoded" -d "id=1" http://localhost:3000/rest/users; echo