Skip to content

Pastorsin/casares-news-api

Repository files navigation

"Casares News" API

Api that scrapes and provides the last news of the city of Carlos Casares by semantic way (RDF format).

Usage

Consume the articles by: https://casares-news.herokuapp.com/articles/

Indicate the file format using the content-type header. Supports JSON-LD, rdf/xml, turtle, n-triples and n3.

E.g.: Get the lastest 5 news in JSON-LD format

ARTICLES="https://casares-news.herokuapp.com/articles/"
HEADER="Content-Type: application/ld+json" 

curl "$ARTICLES?start=0&offset=5" -H $HEADER

You can see other examples in the frontend app: https://pastorsin.github.io/casares-news/

Local execution

Requirements

Install

  1. Install dependencies and perform the initial migrations
make install
  1. Optional: Generate a private key for the webpush notifications
make webpush-gen
  1. Optional: Put the generated key in the .env file
WP_PRIVATE_KEY=<enter_private_key>

Run

Run the server and the scrappers

make app

Run only the server

make server

Run only the scrappers

make scrap

Clean

Remove the generated files

make clean