NOTE: This is a work-in-progress.
A simple mock backend for building prototypes
The idea behind this is to provide a simple and powerful backend that just does what backends do out of the box. Of course, it won't scale—and that's the trade-off. Currently, it offers the following:
- Authentication & Authorization using JWTs
- Persistent storage via RESOURCEful APIs
- Support for common HTTP methods (GET, POST, PUT, PATCH, DELETE)
- Flexible querying
- Full text search
- LIKE/contains/Wildcard
- Regular expressions
- Less than, greater than, equal to, etc.
- Boolean comparison
Retrieves a simple response from the server to ensure it's running properly.
{
"message": String,
"timestamp": Date
}
Authenticates a user and returns a JWT.
{
"username": String,
"password": String
}
{
"authToken": JWT
}
Gets a refreshed token
{
"authToken": JWT
}
Retrieves a list of users from the authentication store
[
{
"$pid": PID,
"username": String,
"role": String
}
]
Retrieves a single user by PID
{
"$pid": PID,
"username": String,
"role": String
}
Creates a new user with a newly generated PID. If either a "$pid" or "$password" property is supplied, it will be overwritten. The "username", "role", "$pass1", and "$pass2" properties are required. In addition, "$pass1" and "$pass2" must match exactly. The username must be unique. Additional properties may also be provided.
{
username: String,
role: String,
$pass1: String,
$pass2: String
}
Patches an existing user. If the supplied PID matches the user with 'username' equal to 'admin', then the 'username' and 'role' properties must be 'admin'. If a '$password' property is supplied, it will be deleted. The '$password' field cannot be modified directly. You must supply the '$pass1' and '$pass2' fields and they must match each other. The 'username' property must be unique. The '$pid', if supplied, will be overwritten by the PID in the URL. Additional properties may be supplied.
{
// NO REQUIRED FIELDS
}
Deletes the user specified by the PID in the URL
Retrieves the list of available roles
[ String ]
Sets the list of available roles
[ String ]
Retrieves the authorization rules
{
// TODO
}
Sets the authorization rules
{
// TODO
}
A brief description of how the Resource APIs work