Skip to content

tobive/diesel_todo_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TODO SERVER WITH ROCKET AND DIESEL

Implementation of RUST class homework on 8/8/2019 with Diesel.

How to install

Make sure Postgres is installed and running. Create .env file to set database url to connect to Postgres.

echo DATABASE_URL=postgres://user:password@localhost/diesel_todo_server > .env

Create the database from diesel by running:

diesel setup

Start the server using:

cargo run

Example

POST

Post json object containing fields title and content

curl -d '{"title":"three","content":"content three"}' -H "Content-Type:application/json" -X POST http://localhost:8000/api/post

GET

Get a list of all todos or by todo title

curl http://localhost:8000/api/list

curl http://localhost:8000/api/list?query=three

DELETE

Delete from list by todo id

curl -X DELETE http://localhost:8000/api/delete?query=1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published