Skip to content

Commit c83d8f2

Browse files
Updated readme documentation
1 parent 0c73d02 commit c83d8f2

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

README.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,68 @@
1-
# html-parser-api
1+
# HTML parser API app
2+
3+
It's a sample application to parse HTML file using API call.
4+
5+
* Ruby version >=2.4.1
6+
```
7+
$ ruby -version
8+
```
9+
10+
* Rails version >=5.2.0
11+
```
12+
$ rails -v
13+
```
14+
* System dependencies
15+
16+
* Configuration[save follow file as database.yml and update configuration as needed]
17+
```
18+
config/database.example.yml
19+
```
20+
21+
* Database creation
22+
```
23+
$ rake db:create
24+
```
25+
26+
* Database initialization
27+
```
28+
$ bundle exec rake db:schema:load
29+
$ bundle exee rake db:test:prepare
30+
```
31+
32+
* Run server
33+
```
34+
$ bundle exec rails s
35+
```
36+
37+
* How to run the test suite
38+
```
39+
$ bundle exec rspec
40+
```
41+
42+
* Services (job queues, cache servers, search engines, etc.)
43+
44+
* Deployment instructions
45+
46+
## API uses example
47+
48+
### 1. Parse a web page[it will parse all content with tag h1, h2, h3 and a]
49+
Request
50+
```
51+
http://localhost:3000/contents/parse?ref_url=http://getbootstrap.com
52+
```
53+
Response
54+
```
55+
{"success":true,"code":200,"message":"OK"}
56+
```
57+
58+
### 2. Fetch list of matched content [it will fetch all of the parsed content]
59+
Request
60+
```
61+
http://localhost:3000/contents
62+
```
63+
Response
64+
```
65+
{"data":[{"id":"1","type":"contents","links":{"self":"http://localhost:3000/contents/1"},"attributes":{"url":"http://getbootstrap.com","tag":"h1","content":"Bootstrap"}},{"id":"2","type":"contents","links":{"self":"http://localhost:3000/contents/2"},"attributes":{"url":"http://getbootstrap.com","tag":"h3","content":"Installation"}},{"id":"3","type":"contents","links":{"self":"http://localhost:3000/contents/3"},"attributes":{"url":"http://getbootstrap.com","tag":"h3","content":"BootstrapCDN"}},{"id":"4","type":"contents","links":{"self":"http://localhost:3000/contents/4"},"attributes":{"url":"http://getbootstrap.com","tag":"h3","content":"Official Themes"}},{"id":"5","type":"contents","links":{"self":"http://localhost:3000/contents/5"},"attributes":{"url":"http://getbootstrap.com","tag":"a","content":"Bootstrap\n"}},{"id":"6","type":"contents","links":{"self":"http://localhost:3000/contents/6"},"attributes":{"url":"http://getbootstrap.com","tag":"a","content":"Home"}},{"id":"7","type":"contents","links":{"self":"http://localhost:3000/contents/7"},"attributes":{"url":"http://getbootstrap.com","tag":"a","content":"Documentation"}},{"id":"8","type":"contents","links":{"self":"http://localhost:3000/contents/8"},"attributes":{"url":"http://getbootstrap.com","tag":"a","content":"Examples"}}]}
66+
```
67+
68+

0 commit comments

Comments
 (0)