Rails API backend for my Maptivity iOS application. This api handles user authentication via JWT token exchange and endpoints for tracking activities that contain geolocation data.
-
Prerequisites:
- Ruby 3.0+
- PostgreSQL
- Bundler
-
Installation:
git clone https://github.com/ericbatiste/maptivity-be.git cd maptivity-be bundle install rails db:create db:migrate -
Start a local server if you have postgresql downloaded:
rails s
| Endpoint | Method | Description | Request Body |
|---|---|---|---|
/api/v1/auth/signup |
POST | Register user | { "user": { "name": "John", "email": "john@example.com", "password": "pass123" } } |
/api/v1/auth/login |
POST | Log in | { "email": "john@example.com", "password": "pass123" } |
/api/v1/auth/refresh |
POST | Refresh token | { "refresh_token": "refresh_token" } |
/api/v1/auth/logout |
DELETE | Log out | Requires Authorization header |
| Endpoint | Method | Description |
|---|---|---|
/api/v1/users/me |
GET | Get user profile |
/api/v1/users/me |
PATCH/PUT | Update profile |
/api/v1/users/me |
DELETE | Delete account |
| Endpoint | Method | Description |
|---|---|---|
/api/v1/activities |
GET | List activities |
/api/v1/activities/:id |
GET | Get activity |
/api/v1/activities |
POST | Create activity |
/api/v1/activities/:id |
PATCH/PUT | Update activity |
/api/v1/activities/:id |
DELETE | Delete activity |
When creating or updating an activity, these parameters are available:
title
designation
notes
start_time
end_time
route
distance
max_speed
average_speed
climbing
descending
- All endpoints except signup, login, and refresh require JWT authentication
- Include the token in requests using:
Authorization: Bearer {token} - When a token expires, use the refresh endpoint to get a new one
This API is currently under active development.