-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
100 additions
and
119 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,42 @@ | ||
# Getting started | ||
|
||
**PseudoRESTAPI** uses GitHub OAuth to authenticate its users. First, you need to create a GitHub account before you can sign in the application. Once this is done, you can now proceed with the basic concepts: | ||
**PseudoRESTAPI** uses GitHub OAuth to authenticate its users. First, you need to create a GitHub account before you can sign in the platform. Once this is done, you can now login. | ||
|
||
- **Project** - refers to your mock server. Once you create a project, you will be given an API key and secret key to access your API endpoints. | ||
## Creating your first app | ||
|
||
- **APIs** - refers to the RESTful API endpoints. Each endpoint can be assigned with a resource, which will be returned in the endpoint's response. | ||
Think of apps as mock servers, which can help you organize and group your fake endpoints. | ||
|
||
- **Resources** - refers to the fake database. There are two sub modules here: | ||
- To create an app, click the **New App** button on the dashboard and complete the form. Click, the **Proceed** button afterwards. | ||
|
||
<ul class="ml-6"> | ||
- You will notice that after saving, a notification will appear on the page displaying your app's secret key. Make sure to copy this secret key as <u>this will be the only time that you will see it!<u> | ||
|
||
<li><b>Resource Models</b> - let's you define the schema for each database table.</li> | ||
- Afterwards, click your new app. This will redirect you to the **Models** page. | ||
|
||
<li><b>Resource Data</b> - the fake data that populates your table.</li> | ||
- The next step is to create your first model, but before that, let's grab your API key. Click the settings button on the left navigation bar, then copy the API key below your app description. Unlike the secret key, you can always view your API key on the **Settings** page. | ||
|
||
</ul> | ||
Now that you've obtained your API key, let's create your models! | ||
|
||
## Creating your first project | ||
## Designing and populating your models | ||
|
||
Once you log in the application, click the **New Project** button and complete the form: | ||
- Click the models button on the left navigation bar. This will redirect you to the **Models** page where you will design the schema and generate the data for your fake database. | ||
|
||
![Create Project](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0001-create-project.png) | ||
- To create your first model, click the **New Model** button. Design your model based on your needs, then click **Proceed**. | ||
|
||
Then, click the save button. You will notice that after saving, a notification will appear on the page displaying your project's secret key. Make sure to copy this secret key since this is the only time that you will see it! | ||
- After saving, the model should appear as a tab menu in the page. Click on the new model and then click the insert (`+`) model data button. | ||
|
||
![Display Secret Key](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0002-display-secret-key-v1.1.png) | ||
- Adjust the slider based on the number of data that you want to generate, and complete the form. Then, click **Proceed**. | ||
|
||
Afterwards, click your new project. This will redirect you to the **API** page. | ||
|
||
The next step is to create your resources and API endpoints, but before that, you must first acquire your API key. Click the settings button on the left navigation bar, then copy the API key below your project description: | ||
|
||
![Display API Key](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0003-display-api-key-v1.1.png) | ||
|
||
Unlike the secret key, you can always view your API key in the **Settings** page. | ||
|
||
Now that you've obtained your API key, let's create your database! | ||
|
||
## Designing and populating your database | ||
|
||
Click the resources button on the left navigation bar. This will redirect you to the **Resources** page where you will design the schema and generate the data for your fake database. | ||
|
||
To create your first model, click the **New Resource Model** button. You will be given many options to design your model but for now, you can follow the guide below: | ||
|
||
![Create Resource Model](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0004-create-resource-model.png) | ||
|
||
You will notice that the table on the right side will adjust based on the schema that we designed earlier. We can populate the table by clicking the **Manage Data < New** button. | ||
|
||
![Create Resource Data](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0005-create-resource-data-v1.1.png) | ||
|
||
Adjust the slider based on the number of data that you want to generate, then click save. | ||
|
||
The table should now display your mock data: | ||
|
||
![Display Resource Data](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0006-display-resource-data-v1.1.png) | ||
|
||
We can add more resources later, but for now let's proceed with creating the API endpoint. | ||
|
||
## Creating the API Endpoint | ||
|
||
The last step for your mock server is to create the API endpoint where you will expose the resources. | ||
|
||
Click the APIs button on the left navigation bar. This will redirect you to the **API** page. | ||
|
||
Afterwards, click the **New API** button and complete the form: | ||
|
||
![Create API Endpoint](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0007-create-api-endpoint.png) | ||
|
||
As you can see, you can select the resources that you created earlier in the previous section. Click save once you're satisfied with the details. | ||
|
||
We can now finally test your mock server. | ||
- The table should now display your mock data. | ||
|
||
## Testing the mock server | ||
|
||
You can test your API endpoint using cURL with the following format: | ||
|
||
```curl | ||
curl -X GET https://gateway.pseudorestapi.com/api/{api-endpoint} -H "Accept: application/json" -u {api-key}:{secret-key} | ||
```js | ||
curl -X GET \ | ||
https://gateway.pseudorestapi.com/{model-name} \ | ||
-H "Accept: application/json" \ | ||
-u {api-key}:{secret-key} | ||
``` | ||
|
||
Note that the gateway application uses the basic scheme to authenticate the user. | ||
|
||
Here's an example in postman: | ||
|
||
![Postman Request](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0008-postman-request-v1.1.png) | ||
|
||
That's it! You've now created your own mock server. | ||
That's it! You've now created your fake server. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# HTTP Methods | ||
|
||
**PseudoRESTAPI** exposes your models via [PseudoGatewayAPI](https://gateway.pseudorestapi.com/). You can use any tool to send requests to your mock server. Just make sure to encode your credentials in **base64** string. | ||
|
||
## GET | ||
|
||
```js | ||
curl -X GET \ | ||
https://gateway.pseudorestapi.com/api/{model-name} \ | ||
-H "Accept: application/json" \ | ||
-u {api-key}:{secret-key} | ||
``` | ||
|
||
## GET by ID | ||
|
||
```js | ||
curl -X GET \ | ||
https://gateway.pseudorestapi.com/api/{model-name}/{id} \ | ||
-H "Accept: application/json" \ | ||
-u {api-key}:{secret-key} | ||
``` | ||
|
||
## POST | ||
|
||
```js | ||
curl -X POST \ | ||
https://gateway.pseudorestapi.com/{model-name} \ | ||
-H "Accept: application/json" \ | ||
-H "Content-Type: application/json" \ | ||
-u {api-key}:{secret-key} \ | ||
-d '{"key1": "value1", "key2": "value2"}' | ||
``` | ||
|
||
## PUT | ||
|
||
```js | ||
curl -X PUT \ | ||
https://gateway.pseudorestapi.com/{model-name}/{id} \ | ||
-H "Accept: application/json" \ | ||
-H "Content-Type: application/json" \ | ||
-u {api-key}:{secret-key} \ | ||
-d '{"key1": "value1", "key2": "value2"}' | ||
``` | ||
|
||
## DELETE | ||
|
||
```js | ||
curl -X DELETE \ | ||
https://gateway.pseudorestapi.com/{model-name}/{id} \ | ||
-H "Accept: application/json" \ | ||
-u {api-key}:{secret-key} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
# PseudoRESTAPI - Official Documentation | ||
# What is PseudoRESTAPI? | ||
|
||
> ⚠️ I'm currently reworking this project. | ||
> Expect the docs to be outdated! | ||
**PseudoRESTAPI** is a hassle-free way to create fake RESTful endpoints, no coding required. Think of it this way: you're a developer itching to test a cool new feature in your app, but diving into server stuff isn't your jam right now. No problem! | ||
|
||
This is the official guide to **PseudoRESTAPI.** | ||
With PseudoRESTAPI, you can avoid the headache of faking fetch requests or crafting fake endpoints. It's like magic for testing. Just log in, give your model a name, cook up some fake data, and boom – you've got a fake server. | ||
|
||
You can start by reading the [Getting Started](/docs/getting-started) to understand the basic concepts and usages so you can immediately begin using the application. | ||
## Why PseudoRESTAPI? | ||
|
||
Other documents detail advance usages, and other information that you might want to check later to better understand the tool. | ||
- **Easy Peasy:** No need to be a coding wizard. Our platform is designed for everyone, from coding ninjas to beginners. | ||
|
||
- **Speedy Testing:** Test your ideas in a snap. PseudoRESTAPI lets you focus on your app without sweating the server stuff. | ||
|
||
- **Model Magic:** Just log in, name your model, and whip up some fake data. PseudoRESTAPI makes fake servers a breeze. | ||
|
||
Ready to dive in? You can begin by reading the [Getting Started](/docs/getting-started). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters