Giter VIP home page Giter VIP logo

nix-education's Introduction

NIX Education

This project is created as part of the training at NIX company. Your task is to create a simple REST API service using Golang to retrieve data from JSONPlaceholder and store specific data in a MySQL database.

Task

  1. Fetch the posts and display them in the console using the standard input/output library - fmt. The correct result of solving this task will be the following output to the console: beginer.task1.result1.png

  2. Thanks to the implemented multithreading using goroutines, our code is supposed to send 100 requests to fetch posts "simultaneously," and upon receiving the responses, display the query results in the console.

  3. Using the code from point 2, instead of displaying the post information in the console, create a file for each post in the "./storage/posts" directory at the project's root and write the post's content there using the standard input/output library for file system operations - ioutil. The content of each file will have the following structure: beginer.task5.pic2.png

    • It's worth noting that when writing the structure to a file, the keys are not preserved; only the values are written separated by a delimiter. Is it possible to write the file structure while preserving the keys?
  4. At JSONPlaceholder, there are users who have posts (/posts?userId=7), and these posts have comments (/comments?postId={postId}). Your task is:

    1. to retrieve posts for the user with id=7, and for each obtained post, concurrently retrieve comments. All received comments should be concurrently written to a database.
    2. Use the goroutines and channels that we're familiar with.
    3. Write the posts and comments to a PostgreSQL database using go-sql-driver/mysql.
    4. You're expected to query comments as soon as you receive information about a post - feel free to initiate routines within other routines. Here's an approximate structure of how the entire process should take place: beginer.task6.pic1.jpg

    As a result, the database should look like this:

    • Posts: beginer.task6.pic2.png
    • Comments: beginer.task6.pic3.png

nix-education's People

Contributors

actionklo avatar

Watchers

 avatar

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.