An express typescript generator to quickly develop REST API's
$ npm install -g xpresso
Install the cli tool
$ npm install -g xpresso
Navigate to the directory you wish to create the project in, and run the init command, followed by the project name. A new folder will be created that follows the name you provide:
$ cd projects && xpresso init comics
Navigate into the newly created directory and create a CRUD route with the route
command:
$ cd comics && xpresso route comic
Next, create a comic model with the model
command:
$ xpresso model comic
Build the project with the npm
command:
$ npm run build
Start the server:
$ npm start
Use any REST client to test out the generated API
- Generates typescript project
- JWT authentication
- Dynamic route creation
- Custom logger with context id
- Request logging with context id
- Tests with Jest
Base commands available from the CLI
$ xpresso
init [options] [name]
model [name]
route [options] [name]
Generates a new xpresso project
$ xpresso init [options] [name]
-r, --repo [repo] specify repository for the project
-s, --summary [summary] set the summary of the project
--no-auth disables jwt authentication
Generates a new model
$ xpresso route [options] [name]
-w, --websocket add a websocket handler
--no-auth disables jwt authentication for this route
--no-spec disables spec file generation for this route
Generates a new model
$ xpresso model [name]
- Option to disable database