Skip to content

tursodatabase/embedded-replicas-with-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embedded Replicas with Rust

A simple web traffic analytics tracking API featuring Turso embedded replicas and Actix.

Development

Create a turso database.

turso db create <db-name>

Get the database credentials:

# db url turso db show --url <db-name> # authentication token turso db tokens create <db-name>

Rename .env.example to .env and update the database credentials:

TURSO_DATABASE_URL= TURSO_AUTH_TOKEN= 

Run project

mkdir -p db && cargo run

Send Requests

Add a new hit:

curl "http://127.0.0.1:$PORT/record" \ -X POST \ -H 'Content-Type: application/json' \ -d '{"title": "About","link": "about-page"}'

Get traffic analytics for a page:

curl "http://127.0.0.1:$PORT/hits?link=about-page"

Note

Info The $PORT above is the value you used in the PORT key inside the .env file.

About

A simple web traffic analytics tracking API featuring Turso & Acti.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published