article-maker

command module
v0.0.0-...-0e08e9b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

Article Maker

An implementation of an article maker system with a CLI tool to fetch comments with a supplied URL and an API for articles.

Getting started

Clone the repository

git clone https://github.com/Lumexralph/article-maker.git

Change into the directory

cd uconv

Install all the necessary packages, run

go mod tidy

Build and install the tool in your computer

go install .

article-maker gets added as a binary in your computer and you can start using it.

It gives you access to 2 tools;

  1. lwc - lowest common words in a list of comments

     article-maker lwc --url https://jsonplaceholder.typicode.com/comments
    

    a json reponse gets printed to the stdout or the terminal like below

     [
             {
                     "word": "amet",
                     "count": 24
             },
             {
                     "word": "ducimus",
                     "count": 31
             },
             {
                     "word": "dolore",
                     "count": 35
             },
             {
                     "word": "assumenda",
                     "count": 35
             }
     ]
    
  2. server - this handles the article maker api. Start the server using the following command as below

     article-maker server --port 5000  // you can supply any port of choice
    

Then you have access to the following endpoints or URL

Feature Method URL Payload
Create an article POST /article { "title": "Game of thrones", "body": "Lorem ipsum dolor sit amet, "category": "Commercials", "publisher": "John Wale", "created_at": "2006-01-02T15:04:05+07:00", "published_at": "2006-01-02T15:04:05+07:00" }
Get all articles GET /article
Update an article PUT /article {"id" : 5, ... POST payload}
Get a specific article by id GET /article/:id
Delete a specific article DELETE /article/:id

For the api, you'll need a postgres database with an env. file

Documentation on the code

Run:

godoc --http=:8080  // visit the URL in the browser

To run tests, run:

go tests // in any package with test file

Errors and bugs

If something is not behaving intuitively, it is a bug and should be reported. Report it here by creating an issue: https://github.com/Lumexralph/article-maker/issues

Copyright (c) 2020 LumexRalph. Released under the Apache License.

Documentation

Overview

Copyright © 2020 OLUMIDE OGUNDELE <olumideralph@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package main implements the execution of the article maker, the tool to fetch comments from a URL and the server for the article API

Directories

Path Synopsis
internal
domain
Package domain contains the entities of the article maker business logic
Package domain contains the entities of the article maker business logic
postgres
Package datastore is the implementation of the database session in use by the server
Package datastore is the implementation of the database session in use by the server
repository
Package repository contains the operations to retrieve or interact with article domain.
Package repository contains the operations to retrieve or interact with article domain.
pkg
server
Package server has the implementation for the article request handlers.
Package server has the implementation for the article request handlers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL