Creating a new project
The pmesh create
command is used to create a new pmesh project by initializing a pm3.yml
file in the current directory based on the files nearby.
However you can also do this manually by creating a pm3.yml
file with your own settings.
Usage
For the sake of demonstration, let’s create a simple Fastify app and use pmesh to serve it. Generally you start with a monorepo structure where a directory has subdirectories for each service, assets, whatever it may be.
In this example, we have a directory called my-api
which contains a Fastify app and a hi.txt
file in the assets
directory.
Directoryassets
- hi.txt
Directorymy-api
- app.ts
- package.json
Let’s run pmesh create
to create a new pmesh project.
By default it will infer the type of wrapper to use based on the files in the directory but you can always choose Skip if you want to do it manually later.
Here’s the generated pm3.yml
file.
You can now run pmesh go
to start the server and confirm everything works:
Note that we did not have to pnpm install
, build anything, or go through any other setup steps. pmesh automatically does this for you based on the directives in the pm3.yml
file, neither will your team members or the CI/CD pipeline
you will no longer need, or the server you deploy to.