Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup and docs #7

Merged
merged 3 commits into from
Sep 2, 2023
Merged
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
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
![image](https://github.com/iNewLegend/web-crawler/assets/10234691/830714f3-c0ec-4b51-add7-d44b0598cc98)
![image](https://github.com/iNewLegend/web-crawler/assets/10234691/279734f9-88ae-4729-9175-742be5b38b7c)

# Requirements
- PHP Version: `8.2`
- MongoDB
- PHP
- Min Version: `8.2`
- MongoDB extension
- Composer
- Node
- NPM
- Angular CLI

# Installation
- Clone the repository
- $ `git clone https://github.com/iNewLegend/web-crawler.git`
- $ `cd web-crawler`
- $ `composer install`


- Setup mongodb connection
- $ `cd crawler-backend`
- $ `cp .env.example .env`
- $ `vim .env`
- Set `MONGODB_URI` to your mongodb connection string
- Set `MONGODB_DB` to your mongodb database name
- Save and exit
- $ Create database collections
- $ `php artisan migrate`
- $ `cd ..`


- Run backend server
- $ `composer dev-start-backend`
- Run frontend server (in another terminal)
- $ `composer dev-start-frontend`

# Major commits
- 2023-08-31 08:00:00 ~ 14:30:00 `New: CrawlerLib - Initial Commit`
Expand Down
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
"dev-start-frontend": [
"Composer\\Config::disableProcessTimeout",
"cd crawler-frontend && ng serve"
],
"clean-vendor": [
"rm -rf crawler-lib/vendor",
"rm -rf crawler-backend/vendor",
"rm -rf crawler-frontend/node_modules"
],
"pre-install-cmd": [
"cd crawler-lib && composer install",
"cd crawler-backend && composer install",
"cd crawler-frontend && npm install"
]
}
}
18 changes: 18 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions crawler-backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_CONNECTION=mongodb
DB_DSN=mongodb://127.0.0.1:27017/?directConnection=true
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
// Submit button
button[type="submit"] {
max-width: 379px;
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">URL</th>
<th scope="col">Text associated</th>
<th scope="col">Depth</th>
<th scope="col">Links count</th>
<th scope="col">Created at</th>
<th scope="col">Updated at</th>
<th scope="col">Actions</th>
</tr>
</thead>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">URL</th>
<th scope="col">Text associated</th>
<th scope="col">Depth</th>
<th scope="col">Links count</th>
<th scope="col">Created at</th>
<th scope="col">Updated at</th>
<th scope="col">Actions</th>
</tr>
</thead>

<tbody>
<tbody>
<tr *ngFor="let item of items" class="cursor-pointer" (click)="onClick(item)">
<th scope="row" >{{ items.indexOf( item ) + 1 }}</th>
<td class="text-start">{{ item.url }}</td>
Expand All @@ -26,5 +27,6 @@
<span class="mx-2" title="Delete" (click)="onDeleteClick(item); $event.stopPropagation()">❌</span>
</th>
</tr>
</tbody>
</table>
</tbody>
</table>
</div>
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">URL</th>
<th scope="col">Text associated</th>
<th scope="col">Created at</th>
<th scope="col">Updated at</th>
</tr>
</thead>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">URL</th>
<th scope="col">Text associated</th>
<th scope="col">Created at</th>
<th scope="col">Updated at</th>
</tr>
</thead>

<tbody>
<tbody>
<tr *ngFor="let item of items" class="cursor-pointer" (click)="onClick(item)">
<th scope="row" >{{ items.indexOf( item ) + 1 }}</th>
<th scope="row">{{ items.indexOf(item) + 1 }}</th>
<td class="text-start">{{ item.url }}</td>
<td>{{ item.text }}</td>
<td>{{ item.createdAt | date:'yyyy-mm-dd HH:mm' }}</td>
<td>{{ item.updatedAt | date:'yyyy-mm-dd HH:mm' }}</td>
</tr>
</tbody>
</table>
</tbody>
</table>
</div>
4 changes: 2 additions & 2 deletions crawler-frontend/src/app/crawler/crawler.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="container mt-5">
<div class="container-fluid mt-5">
<div class="row justify-content-center text-center">
<div class="col-md-8 shadow-sm mb-5 pt-3 pb-2">
<div id="crawler-control-holder" class="col-md-8 shadow-sm mb-5 pt-3 pb-2">
<crawler-control
[selectedCrawler]="selectedCrawler"
[shouldDisableCrawlerControl]="shouldDisableCrawlerControl"
Expand Down
13 changes: 13 additions & 0 deletions crawler-frontend/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@
cursor: pointer;
}

#crawler-control-holder {
max-width: 900px;

// Submit button
button[type="submit"] {
max-width: 379px;
}
}

crawler-display, crawler-display-index {
tr:hover {
td, th {
background-color: var(--bs-gray-100);
}
}
}

.container-fluid {
max-width: 2000px;
}