Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use npx to create new project in installation docs #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions source/docs/0.12/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,22 @@ Open this example on [Runkit!](https://runkit.com/icebob/moleculer-usage)
# Create a Moleculer project
Use the [Moleculer CLI tool](moleculer-cli.html) to create a new Moleculer-based microservices project.

1. Install `moleculer-cli` globally
1. Create a new project (named `first-demo`)
```bash
$ npm install moleculer-cli -g
```
2. Create a new project (named `first-demo`)
```bash
$ moleculer init project moleculer-demo
$ npx -p moleculer-cli moleculer init project moleculer-demo
```
> Press Y to all questions

3. Open project folder
2. Open project folder
```bash
$ cd moleculer-demo
```

4. Start project
3. Start project
```bash
$ npm run dev
```
5. Open the [http://localhost:3000/](http://localhost:3000/) link in your browser. It shows a start page which contains two links to call the `greeter` service via [API gateway](https://github.com/moleculerjs/moleculer-web).
4. Open the [http://localhost:3000/](http://localhost:3000/) link in your browser. It shows a start page which contains two links to call the `greeter` service via [API gateway](https://github.com/moleculerjs/moleculer-web).

{% note info Congratulations! %}
You have just created your first Moleculer-based microservices project! The next step is to check our [examples](examples.html) or [demo projects](https://github.com/moleculerjs/moleculer-examples).
Expand Down
16 changes: 6 additions & 10 deletions source/docs/0.13/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,26 @@ Open this example on [Runkit!](https://runkit.com/icebob/moleculer-usage)
# Create a Moleculer project
Use the [Moleculer CLI tool](moleculer-cli.html) to create a new Moleculer-based microservices project.

1. Install `moleculer-cli` globally
1. Create a new project (named `moleculer-demo`)
```bash
$ npm i moleculer-cli -g
```
2. Create a new project (named `moleculer-demo`)
```bash
$ moleculer init project moleculer-demo
$ npx -p moleculer-cli moleculer init project moleculer-demo
```
> Press `Y` to all questions

> Don't forget to install and start [NATS Server](https://nats.io/download/nats-io/nats-server/). Otherwise, you will get the following error:
> `NATS error. Could not connect to server: Error: connect ECONNREFUSED 127.0.0.1:4222`


3. Open project folder
2. Open project folder
```bash
$ cd moleculer-demo
```

4. Start project
3. Start project
```bash
$ npm run dev
```
5. Open the [http://localhost:3000/](http://localhost:3000/) link in your browser. It shows a start page which contains two links to call the `greeter` service via [API gateway](https://github.com/moleculerjs/moleculer-web).
4. Open the [http://localhost:3000/](http://localhost:3000/) link in your browser. It shows a start page which contains two links to call the `greeter` service via [API gateway](https://github.com/moleculerjs/moleculer-web).

{% note info Congratulations! %}
You have just created your first Moleculer-based microservices project! Next, check out Moleculer's [core concepts](concepts.html) page to get familiar with them and to see how they fit together. Otherwise, check our [examples](examples.html) or [demo projects](https://github.com/moleculerjs/moleculer-examples).
Expand All @@ -76,4 +72,4 @@ You can also check the video below that explains ins and outs of the project tha
# Moleculer Demo Playground
If you don't want to install [moleculer-demo](usage.html#Create-a-Moleculer-project) on your machine you can use interactive playground.

<iframe src="https://codesandbox.io/embed/github/moleculerjs/sandbox-moleculer-project/tree/master/?fontsize=14" title="moleculer-project" allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
<iframe src="https://codesandbox.io/embed/github/moleculerjs/sandbox-moleculer-project/tree/master/?fontsize=14" title="moleculer-project" allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
14 changes: 5 additions & 9 deletions source/docs/0.14/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ Open this example on [Runkit!](https://runkit.com/icebob/moleculer-usage)
# Create a Moleculer project
In this example we use the official [Moleculer CLI tool](moleculer-cli.html) to create a new Moleculer-based microservices project with a sample service and an API Gateway to call it from the browser via REST API.

1. Install `moleculer-cli` globally
1. Create a new project (named `moleculer-demo`)
```bash
$ npm i moleculer-cli -g
```
2. Create a new project (named `moleculer-demo`)
```bash
$ moleculer init project moleculer-demo
$ npx -p moleculer-cli moleculer init project moleculer-demo
```
<div align="center"><img src="assets/usage/usage-demo-1.gif" /></div>

Expand All @@ -60,19 +56,19 @@ In this example we use the official [Moleculer CLI tool](moleculer-cli.html) to
`NATS error. Could not connect to server: Error: connect ECONNREFUSED 127.0.0.1:4222`
{% endnote %}

3. Open project folder
2. Open project folder
```bash
$ cd moleculer-demo
```

4. Start project
3. Start project
```bash
$ npm run dev
```

<div align="center"><img src="assets/usage/usage-demo-2.gif" /></div>

5. Open the [http://localhost:3000/](http://localhost:3000/) link in your browser. It shows a start page which contains two links to call the `greeter` service via [API gateway](https://github.com/moleculerjs/moleculer-web).
4. Open the [http://localhost:3000/](http://localhost:3000/) link in your browser. It shows a start page which contains two links to call the `greeter` service via [API gateway](https://github.com/moleculerjs/moleculer-web).

{% note info Congratulations! %}
You have just created your first Moleculer-based microservices project! Next, check out Moleculer's [core concepts](concepts.html) page to get familiar with them and to see how they fit together. Otherwise, check our [examples](examples.html) or [demo projects](https://github.com/moleculerjs/moleculer-examples).
Expand Down