API what grab rss feeds
It's very simple to get the API up and running. First, create the database (and database
user if necessary) and add them to the .env
file.
APP_ENV=local
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_db_name
DB_USERNAME=your_db_user
DB_PASSWORD=your_password
Then install, migrate, seed, all that jazz:
composer install
php artisan migrate
php artisan serve
The API will be running on localhost:8000
.
- GET
/api/posts
return all posts from all feeds - GET
/api/posts/{ID}
return post with {ID} - GET
/api/posts/{ID}/all
return all posts from feed with {ID} - POST
/api/posts
with json like
{ "title": "", "description": "", "link": "", "guid": "", "feeds_id": "" }
create post - PUT
/api/posts/{ID}
with json like{ "title": "", "description": "", "link": "", "guid": "", "feeds_id": "" }
update post with {ID} - DELETE
/api/posts/{ID}
delete post with {ID}
- GET
/api/feeds
return all feeds - GET
/api/feeds/{ID}
return feed with {ID} - POST
/api/feeds
with json like{ "name": "", "description": "", "url": "", "url_rss": "", "pub_time": "0000-00-00 00:00:00" }
create feed - PUT
/api/feeds/{ID}
with json like{ "name": "", "description": "", "url": "", "url_rss": "", "pub_time": "0000-00-00 00:00:00", }
update feed with {ID} - DELETE
/api/feeds/{ID}
delete feed with {ID}
If you added to crontab * * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1
System will every hour get new posts from all feeds.
Or you can run it manualy php artisan posts:get
https://habr.com/ru/rss/best/daily/?fl=ru
https://medium.com/feed/@kamerk22
Make especial RequestType for request and separate Validation from controller2020.02.26 DoingValidate all Values coming from user or feed2020.02.26 Doing- Enable authorisation
- Write unit tests