-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Leegeunhyeok
committed
May 21, 2018
1 parent
49cf83f
commit 4a4ad18
Showing
6 changed files
with
905 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,170 @@ | ||
# node-school | ||
|
||
> - Node.js κΈ°λ°μ κ΅μ‘μ²μ κΈμ, νμ¬μΌμ νμ± λͺ¨λμ λλ€. | ||
> - κ°λ°μ: μ΄κ·Όν | ||
> μ κ΅ μ΄, λ±, κ³ λ±νκ΅ λ° λ³μ€μ μΉμ μ 보 νμ± λͺ¨λ | ||
μ κ΅ κ΅μ‘μ² νμ μλΉμ€ νμ΄μ§(stu.xxx.go.kr)λ₯Ό νμ±νμ¬ μ΄λ² λ¬ **νμ¬μΌμ **κ³Ό **κΈμν**λ₯Ό Json ννμ λ°μ΄ν°λ‘ μ 곡ν©λλ€. | ||
|
||
## μ€μΉνκΈ° | ||
- npm μ λ‘λ μμ | ||
- λ³Έ μμ€μ½λμ school.js, src/meal.js, src/notice.js, data/data.js νμΌμ μ¬μ©ν νλ‘κ·Έλ¨ ν΄λμ μΆκ°ν©λλ€. | ||
|
||
## μ¬μ© μμ | ||
|
||
#### λΉλκΈ° ν¨μ λ°©μ | ||
|
||
```javascript | ||
/* λͺ¨λ λΆλ¬μ€κΈ° */ | ||
const School = require('../school.js') | ||
|
||
/* κ°μ²΄ μμ± */ | ||
const school = new School() | ||
|
||
/* μλ μμ λ κ²½κΈ°λμ κ΄λͺ κ²½μνκ³κ³ λ±νκ΅λ₯Ό κΈ°μ€μΌλ‘ ν¨ */ | ||
school.init(school.eduType.high, school.region.gyeonggi, 'J100000488') | ||
|
||
/* λΉλκΈ° ν¨μ λ°©μ μμ */ | ||
const sampleAsync = async function() { | ||
console.log('[μ΄λ² λ¬ κΈμ μ 보 - Async]\n') | ||
console.log(await school.getMeal()) | ||
|
||
console.log('\n\n\n') | ||
|
||
console.log('[μ΄λ² λ¬ νμ¬μΌμ - Async]\n') | ||
console.log(await school.getNotice()) | ||
} | ||
|
||
sampleAsync() | ||
|
||
``` | ||
|
||
#### νλΌλ―Έμ€ λ°©μ | ||
|
||
```javascript | ||
/* λͺ¨λ λΆλ¬μ€κΈ° */ | ||
const School = require('../school.js') | ||
|
||
/* κ°μ²΄ μμ± */ | ||
const school = new School() | ||
|
||
/* μλ μμ λ κ²½κΈ°λμ κ΄λͺ κ²½μνκ³κ³ λ±νκ΅λ₯Ό κΈ°μ€μΌλ‘ ν¨ */ | ||
school.init(school.eduType.high, school.region.gyeonggi, 'J100000488') | ||
|
||
/* νλΌλ―Έμ€ λ°©μ μμ */ | ||
const samplePromise = function() { | ||
school.getMeal().then(result => { | ||
console.log('[μ΄λ² λ¬ κΈμ μ 보 - Promise]\n') | ||
console.log(result) | ||
return school.getNotice() | ||
}).then(result => { | ||
console.log('\n\n\n') | ||
console.log('[μ΄λ² λ¬ νμ¬μΌμ - Promise]\n') | ||
console.log(result) | ||
}) | ||
} | ||
|
||
samplePromise() | ||
|
||
``` | ||
|
||
#### λ°νλλ json λ°μ΄ν° νμ | ||
``` javascript | ||
// κΈμ λ°μ΄ν° | ||
{ | ||
'1': '[μ€μ][μ€μ]\nλ°μνλ―Έλ°₯\nλ―Έμκ΅5.6.9....', | ||
'2': '[μ€μ]\nμΌκ°μ΄λμ₯무침5.6.\nμΉΌμμ°Ήμ....', | ||
'3': '[μ€μ]\nν¬μλ°νμ€ν(μ£Όμ)1.2.5.6.9.13.15.\n....', | ||
'4': '', | ||
'5': '', | ||
... | ||
'month': 5, | ||
'day': 3, | ||
'today': '[μ€μ]\nν¬μλ°νμ€ν(μ£Όμ)1.2.5.6.9.13.15.\n....' | ||
} | ||
|
||
|
||
// νμ¬μΌμ | ||
{ | ||
'1': '', | ||
'2': '', | ||
'3': '', | ||
'4': 'κ°κ΅κΈ°λ μΌ', | ||
'5': '' | ||
'6': '' | ||
'7': 'λ체곡ν΄μΌ', | ||
... | ||
'month': 5 | ||
} | ||
``` | ||
## μ¬μ© λ°©λ² | ||
|
||
### School μΈμ€ν΄μ€ μμ± | ||
`school.js` λͺ¨λμ λΆλ¬μμ μΈμ€ν΄μ€λ₯Ό μμ±ν©λλ€. <br> | ||
μμ± ν λ°λμ init()λ₯Ό νΈμΆνμ¬ μνλ νκ΅λ‘ μ΄κΈ°νν©λλ€. | ||
```javascript | ||
const School = require('./school.js') | ||
const school = new School() | ||
|
||
/* | ||
* @param type: νκ΅ μ ν(μ΄, μ€, κ³ , λ³μ€μ μΉμ) | ||
* @param region: κ΅μ‘μ² κ΄ν μ§μ | ||
* @param schoolCode: νκ΅ κ³ μ μ½λ | ||
*/ | ||
school.init(type, region, schoolCode) | ||
``` | ||
|
||
#### νκ΅ μ’ λ₯ | ||
|
||
νκ΅ μ’ λ₯λ μμ±ν μΈμ€ν΄μ€μ `eduType` μμ μ νν μ μμ΅λλ€. | ||
```javascript | ||
const School = require('./school.js') | ||
const school = new School() | ||
|
||
/* μΆλ ₯: 4 */ | ||
console.log(school.eduType.high) | ||
``` | ||
- λ³μ€μ μΉμ: `kindergarden` [1] | ||
- μ΄λ±νκ΅: `elementary` [2] | ||
- μ€νκ΅: `middle` [3] | ||
- κ³ λ±νκ΅: `high` [4] | ||
|
||
#### κ΅μ‘μ² μ§μ | ||
|
||
μ§μμ μμ±ν μΈμ€ν΄μ€μ `region` μμ μ νν μ μμ΅λλ€. | ||
```javascript | ||
const School = require('./school.js') | ||
const school = new School() | ||
|
||
/* μΆλ ₯: stu.sen.go.kr */ | ||
console.log(school.region.seoul) | ||
``` | ||
- μμΈ: `seoul` [stu.sen.go.kr] | ||
- μΈμ²: `incheon` [stu.ice.go.kr] | ||
- λΆμ°: `busan` [stu.pen.go.kr] | ||
- κ΄μ£Ό: `gwangju` [stu.gen.go.kr] | ||
- λμ : `daejeon` [stu.dge.go.kr] | ||
- λꡬ: `deagu` [stu.dge.go.kr] | ||
- μΈμ’ : `sejong` [stu.sje.go.kr] | ||
- μΈμ°: `ulsan` [stu.use.go.kr] | ||
- κ²½κΈ°: `gyeonggi` [stu.goe.go.kr] | ||
- κ°μ: `kangwon` [stu.kwe.go.kr] | ||
- μΆ©λΆ: `chungbuk` [stu.cbe.go.kr] | ||
- μΆ©λ¨: `chungnam` [stu.cne.go.kr] | ||
- κ²½λΆ: `gyeongbuk` [stu.gbe.go.kr] | ||
- κ²½λ¨: `gyeongnam` [stu.gne.go.kr] | ||
- μ λΆ: `jeonbuk` [stu.jbe.go.kr] | ||
- μ λ¨: `jeonnam` [stu.jne.go.kr] | ||
- μ μ£Ό: `jeju` [stu.jje.go.kr] | ||
|
||
#### νκ΅ μ½λ | ||
|
||
νκ΅ κ³ μ μ½λλ [μ¬κΈ°](https://www.meatwatch.go.kr/biz/bm/sel/schoolListPopup.do)μμ νκ΅λͺ μΌλ‘ κ²μν μ μμ΅λλ€. | ||
νκ΅ μ½λλ `X000000000` νμμ 10μ리 λ¬Έμμ΄μ λλ€. | ||
|
||
## λ¬Έμ μ κ³ | ||
κ΅μ‘μ² ννμ΄μ§μ 리λ΄μΌ λ±μ λ¬Έμ λ‘ νμ±μ΄ λΆκ°λ₯ ν μ μμ΅λλ€. [μ΄μ](https://github.com/leegeunhyeok/node-school/issues)λ₯Ό λ¨κ²¨μ£Όμλ©΄ μ΅λν λΉ λ₯΄κ² μμ νμ¬ λ°μνλλ‘ νκ² μ΅λλ€. | ||
|
||
## λΌμ΄μΌμ€ | ||
[MIT](https://github.com/agemor/school-api/blob/master/LICENSE) | ||
|
||
|
||
## μλ¦Ό | ||
λ³Έ νλ‘μ νΈλ [School API](https://github.com/agemor/school-api)λ₯Ό μ°Έκ³ νμ¬ Node.js μ μ©μΌλ‘ μλ‘ ν¬ν ν νλ‘μ νΈμ λλ€. |
Oops, something went wrong.