Skip to content

Commit dd18dc8

Browse files
authored
Quick start! (#531)
1 parent a9dd0d4 commit dd18dc8

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,47 @@ Ada has improved the performance of the popular JavaScript environment Node.js:
4848

4949
> Since Node.js 18, a new URL parser dependency was added to Node.js — Ada. This addition bumped the Node.js performance when parsing URLs to a new level. Some results could reach up to an improvement of **400%**. ([State of Node.js Performance 2023](https://blog.rafaelgss.dev/state-of-nodejs-performance-2023))
5050
51+
## Quick Start
52+
53+
54+
55+
Linux or macOS users might follow the following instructions if they have a recent C++ compiler installed and a standard utility (`wget`)
56+
57+
58+
1. Pull the library in a directory
59+
```
60+
wget https://github.com/ada-url/ada/releases/download/v2.6.10/ada.cpp
61+
wget https://github.com/ada-url/ada/releases/download/v2.6.10/ada.h
62+
```
63+
2. Create a new file named `demo.cpp` with this content:
64+
```C++
65+
#include "ada.cpp"
66+
#include "ada.h"
67+
#include <iostream>
68+
69+
int main(int, char *[]) {
70+
auto url = ada::parse<ada::url>("https://www.google.com");
71+
if (!url) {
72+
std::cout << "failure" << std::endl;
73+
return EXIT_FAILURE;
74+
}
75+
url->set_protocol("http");
76+
std::cout << url->get_protocol() << std::endl;
77+
std::cout << url->get_host() << std::endl;
78+
return EXIT_SUCCESS;
79+
}
80+
```
81+
2. Compile
82+
```
83+
c++ -std=c++17 -o demo demo.cpp
84+
```
85+
3. `./demo`
86+
87+
```
88+
http:
89+
www.google.com
90+
```
91+
5192
## Bindings of Ada
5293
5394
We provide clients for different programming languages through our C API.

0 commit comments

Comments
 (0)