My solution for the True North Node.js Sr - Challenge
- To view architecture diagrams.
Install dependences, node modules:
$ npm install
Go to the file /config/config.json, NOTE: for this example I provide a running environment, using Postgresql DB as service "elephantsql.com" and Rabbitmq as service "cloudamqp.com" for the email service I user Gmail with a real but test account.
{
"debug" : true,
"database":{
"user" : "snigmgei",
"db" : "snigmgei",
"pwd" : "BpbVMSMR4JlTQ-fGjBjhpiVxOlKanmHr",
"host" : "baasu.db.elephantsql.com",
"type" : "postgres"
},
"rabbitmq":{
"url" : "amqp://kewhjifg:d3-DSmkKl9mSzU8xYxORDF_guR7SHI_x@lion.rmq.cloudamqp.com/kewhjifg"
},
"mailer":{
"user": "kikijs2018@gmail.com",
"pwd" : "kikijs2018ABC",
"type": "gmail"
},
"services":{
"api":{
"ip" : "127.0.0.1",
"port" : 8080,
"mapsKey" : "AIzaSyAVqBwjx92F0bRh8f9c9tY8XBnxyJTihYg"
},
"notifications":{
"logFile" : "./services/notifications/log.txt"
}
}
}
To create all the tables that user the api service, you must run this command.
#To create schema.
$ npm run create-schema
To start the two services "Restaurant Api-rest" and "Order messaggin":
#To run Api rest service.
$ npm run api
#To run Order messaging sevice.
$ npm run notif
To run the test:
$ npm run test
To test the api endpoints, check first that the server is runnig by default the url is 'http://127.0.0.1:8080'.
$ npm run test-api