Skip to content

jimcase/rs-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

357e2f3 · May 31, 2024

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unit tests codecov

RS Backend

Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustc --version
~/.cargo/bin/rustc --version
vim ~/.zshrc
export PATH="$HOME/.cargo/bin:$PATH"

Create database

    sqlite3 database.db
CREATE TABLE users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    nombre TEXT NOT NULL,
    email TEXT NOT NULL UNIQUE
);

.tables

.quit

sqlite3 test.db "SELECT * FROM usuarios;"

Run

    cargo install cargo-watch
    cargo watch -x run

Create user:

curl -X POST http://localhost:8080/users \
-H "Content-Type: application/json" \
-d '{"nombre": "Juan Pérez", "email": "[email protected]"}'

Get user:

curl -X GET http://localhost:8080/users/1

Update user:

curl -X PUT http://localhost:8080/users/2 \    
-H "Content-Type: application/json" \
-d '{"nombre": "Juan Pérez Actualizado", "email": "[email protected]"}'

Delete user

curl -X DELETE http://localhost:8080/usuarios/1
```bash

About

Rust backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages