This package provides a simple temporarily persistent server to accompany the technical test set out for new candidates.
Running the following command will start the server on your local machine.
npx @hedgehoglab/frontend-tech-test-server@latest
The server exposes a handful of endpoints for the purposes of the technical test. Data will be persisted for the duration of the process. Once the process is stopped the data will be lost.
All endpoints accept JSON, so an appropriate Content-Type
should be used.
Endpoints requiring authentication should pass the Authorization
header to the endpoint, with a value of Bearer <user token>
where <user token>
is replaced with the token returned from the /api/login
endpoint.
Register a new user.
{
"first_name": "string",
"last_name": "string",
"email": "string",
"password": "string",
"password_confirmation": "string"
}
// Status 200
{
"id": "number",
"first_name": "string",
"last_name": "string",
"email": "string",
"display_picture": "string"
}
// Status 422
{
"statusCode": 422,
"data": {
"errors": {
"first_name": [
"string"
],
"last_name": [
"string"
],
"email": [
"string"
],
"password": [
"string"
],
"password_confirmation": [
"string"
]
}
}
}
// Status 409
{
"statusCode": 409,
"data": {
"message": "string"
}
}
Login as a registered user.
{
"email": "string",
"password": "string"
}
// Status 200
{
"token": "string"
}
// Status 422
{
"statusCode": 422,
"data": {
"message": "string"
}
}
Get a list of users.
🔐 Authentication required
{
"per_page": "number", // optional, default: 10
"page": "number" // optional, default: 1
}
// Status 200
{
"page": "number",
"per_page": "number",
"total": "number",
"total_pages": "number",
"data": [
{
"id": "number",
"first_name": "string",
"last_name": "string",
"email": "string",
"display_picture": "string"
}
]
}
// Status 401
{
"statusCode": "number",
"data": {
"message": "string"
}
}
Create a new user.
🔐 Authentication required
{
"first_name": "string",
"last_name": "string",
"email": "string"
}
// Status 200
{
"id": "number",
"first_name": "string",
"last_name": "string",
"email": "string",
"display_picture": "string"
}
// Status 401
{
"statusCode": "number",
"data": {
"message": "string"
}
}
Delete a user.
🔐 Authentication required
// Status: 204
// Status 422
{
"statusCode": 422,
"data": {
"message": "string"
}
}
// Status 401
{
"statusCode": 401,
"data": {
"message": "string"
}
}