Skip to content

filipe-freitas-dev/user_register_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

user_register_api

A simple RESTful API built with Rust🦀, utilizing the Rocket framework and Diesel ORM for PostgreSQL database interactions.

Features

  • User registration with secure password hashing
  • CRUD operations for user management
  • PostgreSQL integration using Diesel ORM
  • Environment configuration via .env
  • Connection pooling with r2d2
  • JSON serialization/deserialization with serde

Getting Started

Prerequisites

  • Rust (latest stable version)
  • PostgreSQL
  • Diesel CLI

Installation

  1. Clone the repository:

    git clone https://github.com/filipe-freitas-dev/user_register_api.git
    cd user_register_api
  2. Set up environment variables: Create a .env file in the root directory and add your database URL:

    DATABASE_URL=postgres://username:password@localhost/database_name
    JWT_SECRET=yoursupersecret
  3. Install Diesel CLI (if not already installed):

    cargo install diesel_cli --no-default-features --features postgres
  4. Run database migrations:

    diesel setup
    diesel migration run
  5. Build and run the application:

    cargo run

API Endpoints

Method Endpoint Description
POST /users Create a new user
GET /users Retrieve all users
GET /users/{id} Retrieve user by ID
PUT /users/{id} Update user by ID
DELETE /users/{id} Delete user by ID
POST /admins Create admin user
POST /login Athenticate a user

Technologies Used

License

This project is licensed under the MIT License.

About

A simple system to register user on database developed in Rust 🦀

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors