데이터 수집기 From DataServer, Csv File

Overview

Node.js 데이터 수집기 From DataServer, Csv File

실행 방법

가장 중요한 실행방법입니다.

  1. npm run dev 실행 or npm run build 후 npm run start
  2. http://localhost:3000/api-docs 로 접속합니다.

프로젝트 구조와 설계 전반

확장성 측면에서는 MSA 개발 방식이 도움이 된다고 판단하였습니다.

위 설명과 같이 전체적인 설계는 각 api 폴더 내에 모듈을 추가하는 방식으로 서버를 추가 할 수 있습니다. 기본적인 트랜잭션 정보에 대한 RestAPI는 transaction 모듈 CSV 파일을 Database로 저장하는 모듈은 csv 모듈 MockupServer(4001, 4002)로부터 JSON 데이터를 받아 Database에 저장하는 모듈은 server 모듈 총 3가지로 구분지어 모듈을 생성하였습니다.

api 모듈의 구성은 아래와 같습니다. component.ts - MVC패턴 방식 기준 controller 역할을 합니다. 기본적인 로직 구현을 해당 파일에서 진행합니다. service.ts - Database Qurey 진행 전 데이터를 정제하는 로직이 구현되는 파일입니다. dao.ts - Database의 직접적인 생성 및 쿼리 등을 구현합니다. route.ts - api 경로를 설정해줄 수 있습니다. interface/*.ts - 데이터 모델을 저장하는 폴더입니다. schema.yaml - swagger와 연동되며, 각 모듈마다 존재합니다. 각 모듈별로 저장 시 메인 API 게이트웨이를 통해 노출됩니다.

libs 폴더 내의 구성은 아래와 같습니다. databse.ts - sqlite3와 연동하는 부분입니다. scheduler.ts - node-scheduler를 통해 스케쥴러 로직이 구현되는 부분입니다. success.ts - 모든 response form을 통일된 데이터로 전달하기 위해 구현된 부분입니다. swagger.ts - swagger 관련된 설정을 모아둔 파일입니다.

시작 파일은 server.ts입니다.

API Specifications

http(s)://{server_ip}/api-docs 에서 API 명세서를 확인 할 수 있습니다. 예) http://localhost/api-docs

API 명세서는 Postman과 같은 강력한 툴을 사용하더라도 매 번 수동으로 갱신한다는 일이 쉽지 않습니다.

이에 Swagger와 같은 자동 문서화가 되는 라이브러리를 사용하여 매 번 최신화된 명세서를 전달하려고 합니다. 현재 프로젝트는 MSA 개발 방식을 따르고 있어, schema와 route를 하나의 폴더에 넣고 개발하는 것보다는 api 내의 각 모듈별로 schema를 가지는게 좋겠다고 판단하였습니다.

모듈 내에 schema.ymal를 swagger 형식에 맞게 입력하면 자동으로 문서화가 되는 개념으로 진행했습니다.

You might also like...

With this File Manager prepared for PHP/Js, you can perform all file operations on your server without any problems.

FileManager With this File Manager prepared for PHP/Js, you can perform all file operations on your server without any problems. Instead of downloadin

Sep 23, 2022

CLI utility that parses argv, loads your specified file, and passes the parsed argv into your file's exported function. Supports ESM/TypeScript/etc out of the box.

cleffa CLI tool that: Parses argv into an object (of command-line flags) and an array of positional arguments Loads a function from the specified file

Mar 6, 2022

A file manager plugin for logseq(Search unused assets file)

A file manager plugin for logseq(Search unused assets file)

logseq-plugin-file-manager Search files from assets and draws but not used in journals or pages. Please backup files before operation, and before dele

Dec 23, 2022

File Hider - This is a plugin for Obsidian that allows hiding specific files and folders from the file explorer

File Hider - This is a plugin for Obsidian that allows hiding specific files and folders from the file explorer

Dec 16, 2022

Node.js library that provide a cache for file metadata or file content.

@file-cache A cache library for file metadata or file content. It is useful for process that work a given series of files and that only need to repeat

Aug 6, 2022

An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.

An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.

bootstrap-fileinput An enhanced HTML 5 file input for Bootstrap 5.x, 4.x, and 3.x with file preview for various files, offers multiple selection, resu

Jan 3, 2023

A refined tool for exploring open-source projects on GitHub with a file tree, rich Markdown and image previews, multi-pane multi-tab layouts and first-class support for Ink syntax highlighting.

A refined tool for exploring open-source projects on GitHub with a file tree, rich Markdown and image previews, multi-pane multi-tab layouts and first-class support for Ink syntax highlighting.

Ink codebase browser, "Kin" 🔍 The Ink codebase browser is a tool to explore open-source code on GitHub, especially my side projects written in the In

Oct 30, 2022

Google-reviews-crawler - A simple Playwright crawler that stores Google Maps Place/Business reviews to a JSON file.

google-reviews-crawler A simple Playwright crawler that stores Google Maps Place/Business reviews to a JSON file. Usage Clone the repo, install the de

Oct 26, 2022

Refresh - Simple browser reload on file change middleware for your Deno web applications.

refresh Simple browser reload on file change middleware for your Deno web applications. Usage To use refresh middleware, just add a few extra lines to

Dec 19, 2022
Owner
Dominic Kim
🐏🐏🐏🐏Hello World!🐏🐏🐏🐏
Dominic Kim
Import flow for Excel (.xlsx) and CSV file with automated column matching and validation.

RSI react-spreadsheet-import ⚡️ A component used for importing XLS / XLSX / CSV documents built with Chakra UI. Import flow combines: ?? Uploader ⚙️ P

Ugnis 123 Dec 24, 2022
CancerDB: A public domain knowledge graph about cancer treatments that compiles to a CSV file.

CancerDB: A public domain csv file to help build the next great cure CancerDB is a public domain database and website containing facts about all types

Breck Yunits 21 Dec 15, 2022
Scrape tweets from Twitter search results based on keywords and date range using Playwright. Save scraped tweets in a CSV file for easy analysis

Tweet Harvest (Twitter Crawler) Tweet Harvest is a command-line tool that uses Playwright to scrape tweets from Twitter search results based on specif

Helmi Satria 33 Aug 9, 2023
A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM deffiniation and appropriate file structure.

Welcome to function-stencil ?? A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM

Ben Smith 21 Jun 20, 2022
Serve file server with single zip file as file system in Deno.

zipland Serve file server with one-single zip file in Deno. Support zip just zip32 with deflated or uncompressed serving plaintext deflate Examples Yo

Yongwook Choi 18 Nov 2, 2022
Feel free to create new file, don't hesitate to pull your code, the most important thing is that the file name here must match your nickname so that file does not conflict with other people.

Hacktoberfest Indonesia Apa Itu Hacktoberfest ? Hacktoberfest adalah acara tahunan yang bertujuan untuk mendorong berkontribusi kedalam ekosistem open

Juan Daniel 5 Dec 15, 2022
An Obsidian Plugin that allows to export tables from a pane in reading mode to CSV files.

Obsidian Plugin "Table to CSV Exporter" This is my very first attempt in writing a plugin for Obsidian. I didn't even know TypeScript before (but Java

Stefan Wolfrum 26 Dec 27, 2022
Portable Activity Timeline that draws the Timeline based on data given in JSON or CSV format

Portable Activity Timeline that draws the Timeline based on data given in JSON or CSV format. By clicking on any activity a detailed modal window is displayed. Initially developed for post incident investigations to get a overview of the situation in an it-environment.

Daniel 5 Oct 11, 2022
CSVx.js is an open source CSV library written in TypeScript

This project has been transferred to DWTechs. Please update your project dependencies to the latest version from the new repository. Synopsis CSVx.js

Ludovic CLUBER 2 Nov 5, 2022
A little JavaScript plugin to generate PDF, XLS, CSV and DOC from JavaScript Object or DOM element only from the frontend!

?? JavaScript Object to csv, xls, pdf, doc and DOM to html generator ?? A little JavaScript plugin to generate PDF, XLS, CSV and DOC from JavaScript O

null 61 Jan 7, 2023