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; color: #cccccc;
font-weight: bold; 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> </style>
</head> </head>
@ -95,54 +115,55 @@
<h4>Go</h4> <h4>Go</h4>
<pre> <pre>
<code> <code>
package main <span class="keyword">package</span> main
import ( <span class="keyword">import</span> (
"bytes" <span class="string">"bytes"</span>
"encoding/json" <span class="string">"encoding/json"</span>
"net/http" <span class="string">"net/http"</span>
) )
type Order struct { <span class="keyword">type</span> Order <span class="keyword">struct</span> {
OrderID string `json:"order_id"` OrderID <span class="keyword">string</span> <span class="string">`json:"order_id"`</span>
ClientID string `json:"client_id"` ClientID <span class="keyword">string</span> <span class="string">`json:"client_id"`</span>
Amount float64 `json:"amount"` Amount <span class="keyword">float64</span> <span class="string">`json:"amount"`</span>
Currency string `json:"currency"` Currency <span class="keyword">string</span> <span class="string">`json:"currency"`</span>
ClientEmail string `json:"client_email"` ClientEmail <span class="keyword">string</span> <span class="string">`json:"client_email"`</span>
} }
func main() { <span class="keyword">func</span> main() {
order := &Order{ order := &Order{
OrderID: "123", OrderID: <span class="string">"123"</span>,
ClientID: "456", ClientID: <span class="string">"456"</span>,
Amount: 100.0, Amount: <span class="number">100.0</span>,
Currency: "USD", Currency: <span class="string">"USD"</span>,
ClientEmail: "client@example.com", ClientEmail: <span class="string">"client@example.com"</span>,
} }
jsonValue, _ := json.Marshal(order) jsonValue, _ := json.Marshal(order)
_, err := http.Post("{{host}}/order", "application/json", bytes.NewBuffer(jsonValue)) _, err := http.Post("{{host}}/order", <span class="string">"application/json"</span>, bytes.NewBuffer(jsonValue))
if err != nil { <span class="keyword">if</span> err != <span class="keyword">nil</span> {
// handle error <span class="comment">// handle error</span>
} }
} }
</code> </code>
</pre> </pre>
<h4>Node.js</h4> <h4>Node.js</h4>
<pre> <pre>
<code> <code>
const axios = require('axios'); <span class="keyword">const</span> axios = <span class="keyword">require</span>(<span class="string">'axios'</span>);
const order = { <span class="keyword">const</span> order = {
order_id: '123', order_id: <span class="string">'123'</span>,
client_id: '456', client_id: <span class="string">'456'</span>,
amount: 100.0, amount: <span class="number">100.0</span>,
currency: 'USD', currency: <span class="string">'USD'</span>,
client_email: 'client@example.com' 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 => { .then(response => {
console.log(response.data); console.log(response.data);
}) })
@ -155,15 +176,15 @@
<h4>CURL</h4> <h4>CURL</h4>
<pre> <pre>
<code> <code>
curl -X POST {{host}}/order \ curl -X POST <span class="string">{{host}}/order</span> \
-H 'Content-Type: application/json' \ -H <span class="string">'Content-Type: application/json'</span> \
-d '{ -d <span class="string">'{
"order_id": "123", "order_id": "123",
"client_id": "456", "client_id": "456",
"amount": 100.0, "amount": 100.0,
"currency": "USD", "currency": "USD",
"client_email": "client@example.com" "client_email": "client@example.com"
}' }'</span>
</code> </code>
</pre> </pre>