Files
darkstorm-server/internal/darkstorm_backend/README.md
T
2024-05-17 06:45:45 -05:00

87 lines
1.7 KiB
Markdown

# Darkstorm Backend
This is a purposefully "simple" application backend made specifically for _my_ apps. It's purpose is to collect minimal (only what's absolutely necessary) amounts of data while still fulfilling all my needs. I've found that other, off the shelf options such as Firebase are a bit heavy on the data collection. Plus I like to make things :P.
## Standard Header
Any request might or might not need these values. These values can be authenticated via the `TODO` function.
```json
{
X-API-Key: "{API Key}",
Authorization: "Bearer {JWT Token}"
}
```
## Error Response
If an error status code is returned then the body will be as follows.
```json
{
errorCode: "Error value for internal use",
errorMsg: "User error message", //This message is meant to be displayed to the user. May be empty.
}
```
## Users
> TODO: Add the ability to create users and log-in through third-parties (such as Google).
All requsests pertaining to users requires the `X-API-Key` header.
### Create User
> TODO: Email user to confirm.
> TODO: Screen username for offensive words and phrases.
Request:
```json
{
username: "Username",
password: "Password",
email: "Email",
}
```
Return:
```json
{
username: "Username",
token: "JWT Token"
}
```
If returned status is 401, the errorCode will be one of the following:
* username
* Username is already taken
* password
* Password does not follow rules
* email
* Email is already linked to an account
* disallowed
* Username contains words/phases that are not allowed
### Login
Request:
```json
{
username: "Username",
password: "Password",
}
```
Return:
```json
{
token: "JWT Token",
timeout: 0,
}
```