0.1.25 • Published 3 years ago

mao-core v0.1.25

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Mão Core

mao-core is a library that can be used to implement microservices.

Getting started

Create a new Node.js project:

npm init

Create a directory for your project with the following structure:

- package.json
- app/
	- .env
	- index.js
	- config/
		- config.json

Edit the package.json file as follows:

"main": "app/index.js",
"scripts": {
  "start": "nodemon app/index.js"
},
"dependencies": {
	"mao-core": "^0.1.0"
},
"devDependencies": {
  "nodemon": "^2.0.15"
}

Create the file app/index.js with the following content:

// Internal dependencies

const App = require(`mao-core`).App;


// Create the app

let app = new App
(
	[
		// Create your controllers here
	]
);


// Start the app

app.start().catch
(
	(error) =>
	{
		console.log(error.message);
	}
);

Create the file app/config/config.json with the following content (don't forget to replace "your-service-code"):

{
	"mao":
	{
		"core":
		{
			"registry": {"ENV": "MAO_CORE_REGISTRY"},
			"service":
			{
				"name": "your-service-code",
				"url": {"ENV": "MAO_CORE_SERVICE_URL"}
			},
			"server":
			{		
				"host": {"ENV": "MAO_CORE_SERVER_HOST"},
				"port": {"ENV": "MAO_CORE_SERVER_PORT"}
			}
		}
	}
}

Create the .env file with the following content:

MAO_CORE_REGISTRY=http://localhost:8080

MAO_CORE_SERVICE_URL=http://localhost:8081

MAO_CORE_SERVER_HOST=localhost
MAO_CORE_SERVER_PORT=8081

Install dependencies:

npm install

Start the app:

npm start
0.1.25

3 years ago

0.1.24

3 years ago

0.1.23

3 years ago

0.1.22

3 years ago

0.1.21

3 years ago

0.1.20

3 years ago

0.1.19

3 years ago

0.1.18

3 years ago

0.1.17

3 years ago

0.1.16

3 years ago

0.1.15

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago