Code Monkey home page Code Monkey logo

news-demo's Introduction

News Application Demo

Learn how to develop web applications with Go by building a News application.

Here's what the completed application looks like:

demo

The code in this repo is meant to be a reference point for anyone following along with the tutorial.

Prerequisites

  • You need to have Go installed on your computer. The version used to test the code in this repository is 1.15.3.

  • Sign up for a News API account and get your free API key.

Get started

  • Clone this repository to your filesystem.
$ git clone https://github.com/Freshman-tech/news-demo
  • Rename the .env.example file to .env and enter your News API Key.
  • cd into it and run the following command: go build && ./news-demo to start the server on port 3000.
  • Visit http://localhost:3000 in your browser.

news-demo's People

Contributors

ayoisaiah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

news-demo's Issues

Quick Fix: code in blog post doesn't compile

It's not anywhere near as bad as it sounds. The code in this repo works great, the blog post is just slightly out of sync. Quick fix below!

Problem

This is specifically for checkpoint 2. In the blog post at checkpoint two, it shows main.go with the following line:

newsapi := news.NewClient(apiKey, 20)

But this doesn't compile; it gives a type mismatch:

IN: news.NewClient
 have (string, number)
 want (*http.Client, string, int)

Solution

Luckily, the code in the repo at checkpoint 2 works just great, it's just slightly different. The solution is to use this code in the blog post instead!

myClient := &http.Client{Timeout: 10 * time.Second}
newsapi := news.NewClient(myClient, apiKey, 20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.