feat: style css

This commit is contained in:
Urko 2023-07-20 08:58:45 +02:00
parent 80ffe559ef
commit fb11a01fa7
1 changed files with 80 additions and 59 deletions

View File

@ -63,6 +63,26 @@
color: #cccccc;
font-weight: bold;
}
pre {
background-color: #282c34;
color: #abb2bf;
padding: 10px;
border-radius: 5px;
overflow-x: auto;
}
.keyword {
color: #c678dd;
}
.string {
color: #98c379;
}
.number {
color: #61aeee;
}
</style>
</head>
@ -95,54 +115,55 @@
<h4>Go</h4>
<pre>
<code>
package main
<span class="keyword">package</span> main
import (
"bytes"
"encoding/json"
"net/http"
<span class="keyword">import</span> (
<span class="string">"bytes"</span>
<span class="string">"encoding/json"</span>
<span class="string">"net/http"</span>
)
type Order struct {
OrderID string `json:"order_id"`
ClientID string `json:"client_id"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
ClientEmail string `json:"client_email"`
<span class="keyword">type</span> Order <span class="keyword">struct</span> {
OrderID <span class="keyword">string</span> <span class="string">`json:"order_id"`</span>
ClientID <span class="keyword">string</span> <span class="string">`json:"client_id"`</span>
Amount <span class="keyword">float64</span> <span class="string">`json:"amount"`</span>
Currency <span class="keyword">string</span> <span class="string">`json:"currency"`</span>
ClientEmail <span class="keyword">string</span> <span class="string">`json:"client_email"`</span>
}
func main() {
<span class="keyword">func</span> main() {
order := &Order{
OrderID: "123",
ClientID: "456",
Amount: 100.0,
Currency: "USD",
ClientEmail: "client@example.com",
OrderID: <span class="string">"123"</span>,
ClientID: <span class="string">"456"</span>,
Amount: <span class="number">100.0</span>,
Currency: <span class="string">"USD"</span>,
ClientEmail: <span class="string">"client@example.com"</span>,
}
jsonValue, _ := json.Marshal(order)
_, err := http.Post("{{host}}/order", "application/json", bytes.NewBuffer(jsonValue))
if err != nil {
// handle error
_, err := http.Post("{{host}}/order", <span class="string">"application/json"</span>, bytes.NewBuffer(jsonValue))
<span class="keyword">if</span> err != <span class="keyword">nil</span> {
<span class="comment">// handle error</span>
}
}
</code>
</pre>
<h4>Node.js</h4>
<pre>
<code>
const axios = require('axios');
<span class="keyword">const</span> axios = <span class="keyword">require</span>(<span class="string">'axios'</span>);
const order = {
order_id: '123',
client_id: '456',
amount: 100.0,
currency: 'USD',
client_email: 'client@example.com'
<span class="keyword">const</span> order = {
order_id: <span class="string">'123'</span>,
client_id: <span class="string">'456'</span>,
amount: <span class="number">100.0</span>,
currency: <span class="string">'USD'</span>,
client_email: <span class="string">'client@example.com'</span>
};
axios.post('{{host}}/order', order)
axios.post(<span class="string">'{{host}}/order'</span>, order)
.then(response => {
console.log(response.data);
})
@ -155,15 +176,15 @@
<h4>CURL</h4>
<pre>
<code>
curl -X POST {{host}}/order \
-H 'Content-Type: application/json' \
-d '{
curl -X POST <span class="string">{{host}}/order</span> \
-H <span class="string">'Content-Type: application/json'</span> \
-d <span class="string">'{
"order_id": "123",
"client_id": "456",
"amount": 100.0,
"currency": "USD",
"client_email": "client@example.com"
}'
}'</span>
</code>
</pre>