Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
github.com/iic2173-2015-2-grupo2/news-api
NewsItem
Describes a NewsItem.
Field | Type | Description |
---|---|---|
id | number | Unique ID |
title | string | - |
url | string | - |
source | string | Provider |
language | string | Language: en , es . |
body | string | Short description |
image | string | Representative image URL |
User
Describes a User.
Field | Type | Description |
---|---|---|
id | number | Unique ID |
name | string | - |
username | string | Primary key of users |
email | string | - |
Tag
Describes a Tag. News have many tags.
Field | Type | Description |
---|---|---|
id | number | Unique ID |
name | string | Tag name |
Category
Describes a Category. News belongs to one category.
Field | Type | Description |
---|---|---|
id | number | Unique ID |
name | string | Category name |
Person
Describes a Person. News are related with many people.
Field | Type | Description |
---|---|---|
id | number | Unique ID |
name | string | Person name |
Location
Describes a Location. News belongs to one location.
Field | Type | Description |
---|---|---|
id | number | Unique ID |
name | string | Location name |
NewsProvider
Describes NewsItem
source. NewsItem has one NewsProvider
Field | Type | Description |
---|---|---|
id | number | Unique ID |
name | string | News Provider name |
POST
api/v1/auth/signup
Creates an account.
Argument | Type | Description |
---|---|---|
name | string | - |
username | string | - |
email | string | - |
password | string | - |
This returns the account session token
Argument | Type | Description |
---|---|---|
token | string | Access token |
POST
api/v1/auth/token
Re-new expired token
Argument | Type | Description |
---|---|---|
username | string | - |
password | string | - |
This returns the account session token
Argument | Type | Description |
---|---|---|
token | string | Access token |
Each requests must include a valid non-expired
Bearer <token>
asAuthentication
header. Otherwise will return a401 Unauthorized
status code.
GET
api/v1/private/news
Returns a NewsItem
's list
Argument | Type | Default | Description |
---|---|---|---|
page | uint | 0 | Page number |
GET
api/v1/private/news/:id
Returns the NewsItem
associated with that id
GET
api/v1/private/search
Search NewsItem
with:
Argument | Type | Default | Description |
---|---|---|---|
page | uint | 0 | Page number |
tags | []string | Filter by Tag 's name | |
providers | []string | Filter by NewsProvider 's name | |
locations | []string | Search news in this locations | |
people | []string | Search news related with | |
categories | []string | Filter by Categories name |
.../api/v1/private/news?tags=love&tags=kill&providers=cnn&providers=emol&people=name&categories=national
GET
api/v1/private/tags
Returns a Tag
's list
GET
api/v1/private/news_providers
Returns a NewsProvider
's list
GET
api/v1/private/categories
Returns a Category
's list
GET
api/v1/private/people
Returns a Person
's list
GET
api/v1/private/locations
Returns a Location
's list
Install Golang.
Make sure to configure $GOPATH
. For example:
$ export GOPATH=$HOME/Repositories/go
$ export PATH=$PATH:$GOPATH/bin
Get this repository using go
:
$ go get github.com/tools/godep
$ go get github.com/IIC2173-2015-2-Grupo2/news-api
# Project directory
$ cd $GOPATH/src/github.com/IIC2173-2015-2-Grupo2/news-api/
Setup database
# Example values
export NEO4J_HOST="192.168.99.100"
export NEO4J_PORT="7474"
export NEO4J_USER="neo4j"
export NEO4J_PASS="neo4j"
export ANALYTICS_TOKEN="GOOGLE_ANALYTICS_TOKEN"
Setup other environment variables
export ENVIRONMENT="PRODUCTION"
export SECRET_HASH="SECRET_HASH"
export AUTH="ENABLE"
export LOADER_IO_TOKEN="IO_TOKEN"
Build and run the project locally using:
$ make start
Build and run:
$ docker-compose up -d
Log to postgres container:
$ docker exec -it newsapi_db_1 /bin/bash
Log to postgres service:
$ psql -U postgres
Create Database
CREATE DATABASE newsapi;
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.