Giter Club home page Giter Club logo

nhk-server's Introduction

NHK EASY NEWS Backend Server

Important

This server will be refactoring by using Spring Boot instead of Spring MVC

Introduction

This is a backend server that return the news list which scrawl from NHK Easy News website. Implement with Spring Rest Framework and deploy on AWS.

Api

  • /api/news : return a list of the news_list
  • /api/daily_update_news : feed database with the latest news
  • /api/news/:id : return a specific news with id = :id
  • **Don't Recommand to Use !!! **/api/update_all_news : feed database with all news if database being truncated

MySql Database

  1. Create a news_list table:

    CREATE TABLE news_list (
      `news_id` char(25) PRIMARY KEY NOT NULL,
      `title` TEXT NOT NULL,
      `title_with_ruby` TEXT,
      `news_img_url` TEXT,
      `news_url` TEXT,
      `pulic_date` TEXT
    )

File Structure

packages/
├── server
│ 	└── NewsListServer.java
├── Entity
│	└── NewsList.java
├── Main
	└── Main.java
	

Note:

  1. On the NewsListDAOImpl, on geNewsList() 's HQL from NewsList, NewsList is the classname that in the Entity instead of Table Name in MYSQL !!!

  2. Deploying onto AWS, if the error goes like "Incorrect string value:\xF0\x90\x8D..." that means the collation of columns of table is not utf-8, ( it probably is 'latin' ), using SHOW FULL FIELDS FROM news_list to check that, and here is my solution:

    ALTER table `news_list` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci; 
    
    ALTER TABLE `news_list` MODIFY news_id char(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    
    ALTER TABLE `news_list` MODIFY title text CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    
    ALTER TABLE `news_list` MODIFY title_with_ruby text CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    
    ALTER TABLE `news_list` MODIFY news_image_url text CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    
    ALTER TABLE `news_list` MODIFY news_url text CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    
    ALTER TABLE `news_list` MODIFY public_date text CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    

    Need to think about that when creating the table !!!

  3. When injecting data into databse, seeing all the data become question mark, reference: https://blog.csdn.net/qq_36381640/article/details/79185358,https://blog.csdn.net/violet_echo_0908/article/details/51498829, and ALTER TABLE Table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

nhk-server's People

Contributors

pintaigao avatar

Stargazers

 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.