$ cd scalakurs
$ git pull
$ cd oppgaver/del-3
$ git clone https://github.com/froden/scalakurs.git
$ cd scalakurs/oppgaver/del-3
-
Last ned mongoDB
-
Pakk ut :
$ tar zxvf mongodb-linux-x86_64-2.4.8.tgz
(eller unzip i windows)
- Lag katalog til databasen:
$ mkdir -p /home/sjur/mongodbdata
(fks)
- Start mongodb slik:
$ /home/sjur/mongo_installed_here/bin/mongodb --dbpath /home/sjur/mongodbdata
$ cd ~/scalakurs/oppgaver/del-3/
$ ./sbt
> ~re-start
Åpne http://localhost:8080/ i nettleseren
> re-stop
- Implementer scalakurs.ArticlesController slik at artikler kan addes og editeres, og kommentarer legges på artikler
GET /articles #get all articles
POST /articles #create new article
GET /articles/:id #get single article
PUT /articles/:id #update existing article
DELETE /articles/:id #remoeve article
POST /articles/:id/comments #create new comment on article
DELETE /articles/:id/comments #delete all comments from article
#article with comments
{
"_id": "1234zxcvdas",
"author": "Frode",
"title": "A blogpost",
"content": "Loong and informative post"
"comments": [
{
"author": "Sjur",
"content": "Nice post!",
},
{
"author": "Arild",
"content": "Could be shorter."
}
]
}