1.1.1 • Published 8 years ago
arc.app-example v1.1.1
Arc Example App
- This app demonstrates how to create a microservice, and add functionality with an extension using Arc.
 
Install
npm install arc.app-exampleMicroservice
/microservice/example/index.js
module.exports = () => {
  return `Hello, World!`;
};- A micoservice at it's most basic is just a node module.
 - If you want to know more about microservices, check the Arc wiki.
 
Microservice Configuration
/microservice/example/config.js
module.exports = {
  'Example': {
    protocol   : `example-protocol-name://`,
    resource   : `example`,
    description: `This is a basic microservice example`
  }
};- A microservice configuration is an object that has properties used for configuartions
 - If you want to know about how to configure a microservice, check the Arc wiki.
 
The Application
/index.js
const arc          = require(`arcms`);
const apiExtension = require(`arc.extension-api`);
const config       = require(`./microservice/example/config`);
// Add the API extension to Arc and set the API extension to run on port 8080
arc.addExtension(apiExtension, {
  port: 8080
});
// Arc configures and starts an example microservice
arc(config)
  .then(() => {
    console.log(`Arc Example Online`.bold.cyan);
  });- You can learn more about Arc extensions in the Arc wiki.
 - You can learn more about configuring microservices in the Arc wiki.
 
Start Redis
sudo service redis-server startRun
npm start- View the API by visiting 
http://localhost:8080