새 명령 프롬프트를 하나 더 열어 test.js 파일을 실행합니다.
> node test.js
============================== members ==============================
{ host: '127.0.0.1',
port: 8000,
headers: { 'Content-Type': 'application/json' },
method: 'DELETE',
path: '/members?username=test_account' } '{"errorcode":0,"errormessage":"success"}'
{ host: '127.0.0.1',
port: 8000,
headers: { 'Content-Type': 'application/json' },
method: 'POST',
path: '/members' } '{"errorcode":0,"errormessage":"success"}'
{ host: '127.0.0.1',
port: 8000,
headers: { 'Content-Type': 'application/json' },
method: 'GET',
path: '/members?username=test_account&password=1234' } '{"errorcode":0,"errormessage":"success","userid":3}'
============================== goods ==============================
{ host: '127.0.0.1',
port: 8000,
headers: { 'Content-Type': 'application/json' },
method: 'POST',
path: '/goods' } '{"errorcode":0,"errormessage":"success"}'
{ host: '127.0.0.1',
port: 8000,
headers: { 'Content-Type': 'application/json' },
method: 'GET',
path: '/goods' } '{"errorcode":0,"errormessage":"success","results":[{"id":2,
"name":"test Goods","category":"tests","price":1000,"description":"test"},{"id":3,
"name":"test Goods","category":"tests","price":1000,"description":"test"}]}'
{ host: '127.0.0.1',
port: 8000,
headers: { 'Content-Type': 'application/json' },
method: 'DELETE',
path: '/goods?id=1' } '{"errorcode":0,"errormessage":"success"}'
============================== purchases ==============================
{ host: '127.0.0.1',
port: 8000,
headers: { 'Content-Type': 'application/json' },
method: 'POST',
path: '/purchases' } '{"errorcode":0,"errormessage":"success"}'
{ host: '127.0.0.1',
port: 8000,
headers: { 'Content-Type': 'application/json' },
method: 'GET',
path: '/purchases?userid=1' } '{"errorcode":0,"errormessage":"success","results": [{"id":1,"goodsid":1,"date":"2017-05-10T09:34:17.000Z"},{"id":2,"goodsid":1,"date": "2017-05-10T09:34:32.000Z"},{"id":3,"goodsid":1,"date":"2017-05-10T09:36:25.000Z"},{ "id":4,"goodsid":1,"date":"2017-05-10T10:12:06.000Z"},{"id":5,"goodsid":1,"date":"2017-05-10T10:12:32.000Z"},{"id":6,"goodsid":1,"date":"2017-05-10T10:13:31.000Z"},{"id":7, "goodsid":1,"date":"2017-05-10T10:17:35.000Z"},{"id":8,"goodsid":1,"date":"2017-05-11T03:12:14.000Z"},{"id":9,"goodsid":1,"date":"2017-05-11T07:26:09.000Z"},{"id":10,"goodsid" :1,"date":"2017-05-19T09:18:46.000Z"},{"id":11,"goodsid":1,"date":"2017-05-19T09:19: 19T09:19:13.000Z"},{"id":12,"goodsid":1,"date":"2017-05-22T10:14:04.000Z"}]}'
done
Node.js를 이용해 모놀리식 아키텍처 서비스를 만들고 정상적으로 동작하는지 확인했습니다. 다음 장에서는 본격적으로 마이크로서비스를 구현하고, 구현에 필요한 개념들과 구현 과정을 알아보겠습니다.