Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baguswijaksono/jsons
Extremely simple JSON storage for web and mobile apps unit testing, with only one file.
https://github.com/baguswijaksono/jsons
json-api json-storage php8
Last synced: about 1 month ago
JSON representation
Extremely simple JSON storage for web and mobile apps unit testing, with only one file.
- Host: GitHub
- URL: https://github.com/baguswijaksono/jsons
- Owner: baguswijaksono
- Created: 2023-12-01T21:50:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-31T06:38:11.000Z (12 months ago)
- Last Synced: 2024-12-16T03:11:19.390Z (about 1 month ago)
- Topics: json-api, json-storage, php8
- Language: PHP
- Homepage: https://jsons.baguswinaksono.my.id/
- Size: 175 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# User Interface Preview
Few image of this web app User Interface
| Add JSON Page | Edit JSON Page |
|---|---|
| ![Add Image](https://raw.githubusercontent.com/baguswijaksono/json-storage/main/imagedocs/add.png) | ![Edit Image](https://raw.githubusercontent.com/baguswijaksono/json-storage/main/imagedocs/edit.png) || Get JSON Page | Home Page |
|---|---|
| ![Get JSON Image](https://raw.githubusercontent.com/baguswijaksono/json-storage/main/imagedocs/getjson.png) | ![Home Image](https://raw.githubusercontent.com/baguswijaksono/json-storage/main/imagedocs/home.png) || Login Page | Register Page |
|---|---|
| ![Login Image](https://raw.githubusercontent.com/baguswijaksono/json-storage/main/imagedocs/login.png) | ![Register Image](https://raw.githubusercontent.com/baguswijaksono/json-storage/main/imagedocs/register.png) |# Fetching Data from an API
## Get JSON
| Parameter | Description |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id` (int) | Example: `GET /?page=json&id=4` |## PHP Example
The PHP example demonstrates fetching data from an API using `file_get_contents` and handling the response.
```php
```
## JavaScript Example
The JavaScript example uses fetch to retrieve data from an API and handles the response asynchronously.```js
const apiUrl = 'URL'; // Replace with your API endpointfetch(apiUrl)
.then(response => {
if (!response.ok) {
throw new Error(`Network response was not ok: ${response.status}`);
return response.json();
})
.then(data => {
console.log('Fetched data:', data);
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
});
```