Development
simpi dev runs your APIs at http://localhost:3030 in development mode NODE_ENV=development.
You get a few features out of the box:
- built-in Typescript support,
- hot reloading, eliminating the need for server restarts,
- and more
Argument
This CLI serves APIs from the root api directory but can be changed like so:
npx simpi dev srcOptions
Please type npx simpi dev --help to get the list of options available:
Options:
-p, --port <number> port number on which to start the API server (default: 3030)
--no-watch disable hot reload
-h, --help display help for commandPort
The default port 3030 can also be changed with the option -p:
npx simpi dev -p 80or via the PORT environment variable:
PORT=80 npx simpi devWatch
By default, simpi dev will watch for changing in your working directory and invalidates the module cache
for hot reloading. However, you can choose to disable watching for changes with the following option:
npx simpi dev --no-watchPlease note that this option does not prevent files from being transpiled into JavaScript in development mode.
Building
simpi build bundle and build optimized artifacts that will be used to run your production API.
Argument
This CLI generates APIs from the root api directory but can be changed like so:
npx simpi build srcPlease note that the API directory needs to match for all commands (i.e simpi dev, simpi build and simpi start).
Options
Please type npx simpi build --help to get the list of options available:
Options:
--copy-files copy all files in working directory
-h, --help display help for commandCopy all files
By default, simpi build will only copy and transpile JavaScript and TypeScript files. With the
option --copy-files, all files in the working directory will be copied over the cache storage.
npx simpi build --copy-filesProduction
simpi start runs your APIs at http://localhost:80 in production mode NODE_ENV=production.
The APIs should be compiled first by simpi build.
The production server is built for speed and with security in mind.
Options
Please type simpi start --help to get the list of options available:
Options:
-p, --port <number> port number on which to start the API server (default: 80)
-h, --help display help for commandPort
The default port 80 can also be changed with the option -p:
npx simpi start -p 8080or via the PORT environment variable:
PORT=8080 npx simpi startTesting
simpi test parse your project and allow you to test your API in testing mode NODE_ENV=testing.
Amongst other things, simpi test will:
- automatically run unit tests (files with the following pattern
*.test.{ts,js})
Please note that by default simpi will run your tests concurrently based on your OS.