GET URL : https://mora-bot.kr/api/v1/grammar?string={검사할 문장}
Field
Type
Description
// 응답 내용{"message":"there is nothing wrong","license":"hanspell module used https://www.npmjs.com/package/hanspell","status":200,"original":"안녕하세요","errnum":0,"success":true}
NodeJS
// node-fetchlet text ='검사할 문장'constfetch=require('node-fetch')fetch(`https://mora-bot.kr/api/v1/grammar?string=${encodeURI(text)}`).then(res =>res.json()).then(json => {console.log(`라이선스 : ${json.license}`)console.log(`원래 문장 : ${json.original}`)console.log(`틀린 부분 : ${json.wrong}`)console.log(`추천 : ${json.suggestions}`)console.log(`해설 : ${json.more}`) });// requestlet text ='검사할 문장'let api_url =`https://mora-bot.kr/api/v1/grammar?string=${encodeURI(text)}`constrequest=require('request');let options = { url: api_url}request.get(options,function (error, response, body) {if (!error &&response.status ==200) {let json =JSON.parse(body)console.log(`라이선스 : ${json.license}`)console.log(`원래 문장 : ${json.original}`)console.log(`틀린 부분 : ${json.wrong ||0}`)console.log(`추천 : ${json.suggestions ||'틀린 부분 없음'}`)console.log(`해설 : ${json.more ||'틀린 부분 없음'}`) } else {console.log('error = '+response.errorcode); }});