-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
62 lines (46 loc) · 1.38 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { getSchedule } from './util/ScheduleData'
let express = require('express')
let app = express()
import School from 'node-school-kr';
const school = new School()
import bodyParser from 'body-parser';
import { TextMessage ,TextMessage2} from "./views";
import { getAllCalender, getCalendar } from './util/Calendar'
import { getSchoolFood } from './util/SchoolFood'
school.init(School.Type.HIGH, School.Region.SEOUL, 'B100000589')
const port = process.env.PORT || 3000
app.use(bodyParser.urlencoded({
extended: false
}))
app.use(bodyParser.json())
app.get('/', async function (req, res) {
res.send("ㅎㅇ")
})
//급식 파트
app.post('/sendFood', async (req, res) => {
res.send(TextMessage(await getSchoolFood(school)))
})
//일주일 일정
app.post('/getWeekCalendar', async function (req, res) {
res.send(TextMessage(await getCalendar(school)))
})
//한달 일정
app.post('/getAllCalendar', async (req, res) => {
res.send(TextMessage(await getAllCalender(school)))
})
//시간표
app.post("/getAllSchedule",(req,res) => {
let grade = req.body.action.params.grade;
let classNum = req.body.action.params.classNum;
res.send(TextMessage(getSchedule(grade,classNum)))
})
// 날씨 정보
app.post('/getWeather', (req, res) => {
})
// 미세먼지
app.post('/getDustPM', (req, res) => {
})
// 초미세먼지
app.listen(port, () => {
console.log(`app is Listening at ${port}`)
})