김대선

공고명, 회사명, Tag를 통한 데이터 조회 기능 구현

const express = require('express')
const schedule = require('node-schedule')
const dataFunctions = require('./functions/dataFunctions')
const data = require('./functions/dataFunctions')
const find = require('./functions/findFunction')
const app = express();
// 0초 0분 0시 아무날 아무달 아무년
const saveData = schedule.scheduleJob('55 45 20 * * *', dataFunctions.save)
const saveData = schedule.scheduleJob('55 45 20 * * *', data.save)
const server = app.listen(3000,()=>{
const host = server.address().address
......@@ -19,6 +19,6 @@ const server = app.listen(3000,()=>{
app.get('/', async (req, res)=>{
data = await dataFunctions.read()
res.send(data)
console.log(find.byCompanyName('naver')[0], find.byTags('백엔드')[0], find.byTitle('백엔드')[0])
res.send('helloworld')
})
\ No newline at end of file
......
const fs = require('fs')
const functions = require('./function')
const read = async () =>{
const read = () =>{
const data = []
let title = ""
let tags = []
......
const data = require('./dataFunctions')
const byCompanyName = function(companyName){
return data.read().filter(data => data.companyName.includes(companyName))
}
const byTags = function(tag){
return data.read().filter(data => data.tags.join().includes(tag))
}
const byTitle = function(title){
return data.read().filter(data => data.title.includes(title))
}
module.exports = {
byCompanyName : byCompanyName,
byTags : byTags,
byTitle : byTitle
}
\ No newline at end of file