Skip to content

PrawiraGenestonlia/create-express-typescript-application

Repository files navigation

express typescript

create-express-typescript-application.

NPM Version Package License NPM Downloads Wallaby.js

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:

  1. plain mode - lightweight express typescript app (--type plain)
  2. typeorm mode - lightweight express typescript app with typeorm (sqlite included) and swagger (OpenAPI documentation) integrated
  3. 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.

Install this package globally in your environment:

$ npm install -g create-express-typescript-application

Or use npx to execute this package without installing it globally:

$ npx create-express-typescript-application

List of Generator Options

Options:
  -V, --version              output the version number
  -d, --debug                output extra debugging
  -t, --template <template>  specify only prisma, plain or typeorm
  -p, --prisma               define template prisma
  -y, --typeorm              define template typeorm
  -h, --help                 display help for command

The --prisma option integrates Prisma ORM into any of the lightweight app templates.

Quick Start

The quickest way to get started is use npx and pass in the name of the project you want to create.

Create a new Express app with the default plain template:

$ create-express-typescript-application {project-name-without-spaces}

Or create a new Express app using a specific template:

# plain (lightweight, default)
$ create-express-typescript-application {project-name-without-spaces} -t plain

# typeorm (lightweight)
$ create-express-typescript-application {project-name-without-spaces} -t typeorm

# prisma (fullweight)
$ create-express-typescript-application {project-name-without-spaces} -t prisma

Navigate into the generated folder to work on your new app:

$ cd {project-name-without-spaces}

Development Script Commands

  • Run the server in development mode: npm run dev.
    • with the default port, your app will be accessible at http://localhost:8080/.
    • if Swagger is included, your API docs will be accessible at http://localhost:8080/docs.
  • Build the project for production: npm run build.
  • Run the production build: npm start.
    • note: this requires the app to be built first.

License

MIT

About

create-express-typescript-application cli using npx command

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published