Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/resources/views/partials/route.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,24 @@
```

```javascript
var settings = {
"async": true,
"crossDomain": true,
"url": "{{ rtrim(config('app.docs_url') ?: config('app.url'), '/') }}/{{ ltrim($parsedRoute['uri'], '/') }}",
"method": "{{$parsedRoute['methods'][0]}}",

const headers = new Headers({'Accept': 'application/json'})

const settings = {
method: "{{$parsedRoute['methods'][0]}}"
credentials: 'include'
headers,
@if(count($parsedRoute['parameters']))
"data": {!! str_replace("\n}","\n }", str_replace(' ',' ',json_encode(array_combine(array_keys($parsedRoute['parameters']), array_map(function($param){ return $param['value']; },$parsedRoute['parameters'])), JSON_PRETTY_PRINT))) !!},
body: {!! str_replace("\n}","\n }", str_replace(' ',' ',json_encode(array_combine(array_keys($parsedRoute['parameters']), array_map(function($param){ return $param['value']; },$parsedRoute['parameters'])), JSON_PRETTY_PRINT))) !!},
@endif
"headers": {
"accept": "application/json"
}
}

$.ajax(settings).done(function (response) {
console.log(response);
});
const request = new Request("{{ rtrim(config('app.docs_url') ?: config('app.url'), '/') }}/{{ ltrim($parsedRoute['uri'], '/') }}", settings)

fetch(request)
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error(error))
```

@if(in_array('GET',$parsedRoute['methods']) || (isset($parsedRoute['showresponse']) && $parsedRoute['showresponse']))
Expand Down
69 changes: 37 additions & 32 deletions tests/Fixtures/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
title: API Reference

language_tabs:
- bash
- javascript
- bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for these indentation changes? They're causing the build to fail.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think That was Prettier Auto formatting
i'll fix them ASAP

- javascript

includes:
? includes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason?


search: true

toc_footers:
- <a href='http://github.com/mpociot/documentarian'>Documentation Powered by Documentarian</a>
- <a href='http://github.com/mpociot/documentarian'>Documentation Powered by Documentarian</a>
---

<!-- START_INFO -->

# Info

Welcome to the generated API reference.
Expand All @@ -21,7 +23,9 @@ Welcome to the generated API reference.
<!-- END_INFO -->

#general

<!-- START_0bef4e738c9d6720ad43b062015d1078 -->

## Example title.

This will be the long description.
Expand All @@ -35,19 +39,20 @@ curl -X GET -G "http://localhost/api/test" \
```

```javascript
var settings = {
"async": true,
"crossDomain": true,
"url": "http://localhost/api/test",
"method": "GET",
"headers": {
"accept": "application/json"
}
}
const headers = new Headers({ Accept: "application/json" });

$.ajax(settings).done(function (response) {
console.log(response);
});
const settings = {
method: "GET",
credentials: "include",
headers
};

const request = new Request("http://localhost/api/test", settings);

fetch(request)
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error(error));
```

> Example response:
Expand All @@ -57,12 +62,13 @@ null
```

### HTTP Request
`GET api/test`

`GET api/test`

<!-- END_0bef4e738c9d6720ad43b062015d1078 -->

<!-- START_960a1b2b0f0f4dde8ce993307397f9c4 -->

## api/fetch

> Example request:
Expand All @@ -73,19 +79,20 @@ curl -X GET -G "http://localhost/api/fetch" \
```

```javascript
var settings = {
"async": true,
"crossDomain": true,
"url": "http://localhost/api/fetch",
"method": "GET",
"headers": {
"accept": "application/json"
}
}
const headers = new Headers({ Accept: "application/json" });

const settings = {
method: "GET",
credentials: "include",
headers
};

const request = new Request("http://localhost/api/fetch", settings);

$.ajax(settings).done(function (response) {
console.log(response);
});
fetch(request)
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error(error));
```

> Example response:
Expand All @@ -101,9 +108,7 @@ $.ajax(settings).done(function (response) {
```

### HTTP Request
`GET api/fetch`

`GET api/fetch`

<!-- END_960a1b2b0f0f4dde8ce993307397f9c4 -->


Loading