Code Monkey home page Code Monkey logo

node_1_exercise's Introduction

Yêu cầu

  • Viết chương trình chạy bằng nodejs để đọc n page từ các link nằm trong links.json (link là các trang nội dung được chia theo page, mình mới demo 1 link rồi, các bạn tự bỏ thêm vào 2,3 link nữa)
  • và lưu nội dung vào thư mục theo cấu trúc ngày/link/page.html (VD 12_3_2020/viblo.asia/page2.html)
  • số n được lấy từ terminal VD: node script.js 4 -> sẽ lấy 4 page đầu tiên của mỗi link

Gợi ý

  • Tìm hiểu cách sử dụng module fileSystem
  • Cách cài và sử dụng module request hoặc node-fetch từ npm
  • Cách đọc args -> học cách search google :))

Chú ý:

  • nên làm, commit và push code từng phần hơn là làm 1 lần cho xong
  • nên refactor lại thành nhiều hàm util rồi tách module ra

Bài làm

Nam: https://github.com/htactive-nampd/save-web-page

Linh: https://github.com/htactive-bvlinh/nodejs-lab1

Thịnh: https://github.com/htactive-pvpThinh/Nodejs01/

Việt: https://github.com/HTactive-thViet/getPage/

111

rootLinks = [...]

mutation state

transform data

1/ Architect process version 1 = links => downloadLink( "https://viblo.asia/newest?page=2 ) => request(downlink): Promise => content => Promise => file process version 2 = links => downloadLink( "https://viblo.asia/newest?page=2 ) => request(downlink): Promise => content => procees() => Promise => file processWithNodeFetch = solution = pipe

2/ Kĩ thuật

node_1_exercise's People

Contributors

htactive-nhattvm 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.