Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/iic2173-2015-2-grupo2/news-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/iic2173-2015-2-grupo2/news-api

  • v0.0.0-20151130124215-9a33253e84fa
  • Source
  • Go
  • Socket score

Version published
Created
Source

News-API

Build Status Code Climate

Format & style: gofmt, golint, govet

API Documentation

Objects

NewsItem

Describes a NewsItem.

FieldTypeDescription 
id numberUnique ID
title string-
urlstring-
sourcestringProvider
 languagestringLanguage: en, es.
body stringShort description
imagestringRepresentative image URL
User

Describes a User.

FieldTypeDescription 
id numberUnique ID
name string-
usernamestringPrimary key of users
emailstring-
Tag

Describes a Tag. News have many tags.

FieldTypeDescription 
id numberUnique ID
name stringTag name
Category

Describes a Category. News belongs to one category.

FieldTypeDescription 
id numberUnique ID
name stringCategory name
Person

Describes a Person. News are related with many people.

FieldTypeDescription 
id numberUnique ID
name stringPerson name
Location

Describes a Location. News belongs to one location.

FieldTypeDescription 
id numberUnique ID
name stringLocation name
NewsProvider

Describes NewsItem source. NewsItem has one NewsProvider

FieldTypeDescription 
id numberUnique ID
name stringNews Provider name

API Usage

POST api/v1/auth/signup

Creates an account.

Argument TypeDescription
namestring-
usernamestring-
emailstring-
passwordstring-

This returns the account session token

Argument TypeDescription
tokenstringAccess token
POST api/v1/auth/token

Re-new expired token

Argument TypeDescription
usernamestring-
passwordstring-

This returns the account session token

Argument TypeDescription
tokenstringAccess token

Authenticated API Usage

Each requests must include a valid non-expired Bearer <token> as Authentication header. Otherwise will return a 401 Unauthorized status code.

GET api/v1/private/news

Returns a NewsItem's list

Argument TypeDefaultDescription
pageuint0Page number
GET api/v1/private/news/:id

Returns the NewsItem associated with that id

GET api/v1/private/search

Search NewsItem with:

Argument TypeDefaultDescription
pageuint0Page number
tags[]stringFilter by Tag's name
providers[]stringFilter by NewsProvider's name
locations[]stringSearch news in this locations
people[]stringSearch news related with
categories[]stringFilter by Categories name
Example
.../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

Development

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/

Local

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

Docker

Build and run:

$ docker-compose up -d
Setup Postgres

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

Package last updated on 30 Nov 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc