create-express-typescript-application
v2.2.9
Published
Create a new lightweight Express application with TypeScript
Downloads
56
Maintainers
Readme
create-express-typescript-application.
Why create-express-typescript-application?
create-express-typescript-application creates a new lightweight express application which is fully customizable for your use case. With the support of TypeScript, it allows a robust NodeJS express app to serve as an RESTful backend server.
There are three modes of create-express-typescript-application, mainly:
- plain mode - lightweight express typescript app (--type plain)
- typeorm mode - lightweight express typescript app with typeorm (sqlite included) and swagger (OpenAPI documentation) integrated
- prisma mode - fullweight express typescript app with prisma (relational database ORM) and swagger (OpenAPI documentation) integrated
You are highly recommended to use typeorm template if database is required in this project, otherwise, plain mode.
Application Details
When you run create-express-typescript-application, it sets up a very simple application without junk packages. The src/app/sample folder shows how easy it is to create new routes.
Installation
Pre-requisite: Node, npm and git are locally installed.
$ Just use 'npx'
Or
$ npm install -g create-express-typescript-application
$ create-express-typescript-application {project-name-without-spaces}
# example (plain lightweight) $ create-express-typescript-application {project-name-without-spaces} -t plain
# example (typeorm lightweight) $ create-express-typescript-application {project-name-without-spaces} -t typeorm
# example (prisma fullweight) $ create-express-typescript-application {project-name-without-spaces} -t prisma
Quick Start
The quickest way to get started is use npx and pass in the name of the project you want to create. It is invalid to exclude project name.
Create the app:
$ npx create-express-typescript-application {project-name-without-spaces}
Start your express-app in development mode at http://localhost:8080/
$ cd "project name" && npm run dev
If swagger is included, you can view the swagger file at http://localhost:8080/docs
Or build your application and serve it.
$ cd "project name" && npm run build && npm start
List of options.
Options: -V, --version output the version number -d, --debug output extra debugging -t, --template specify only prisma or plain or typeorm -p, --prisma define type prisma -y, --typeorm define type typeorm -h, --help display help for command
Prisma options integrates prisma ORM into the lightweight express typescript app.
Available commands for the server.
- Run the server in development mode:
npm run dev
. - Build the project for production:
npm run build
. - Run the production build:
npm start
.