new-express-app
NPM package to create new pre-configured express app for REST API's from the command line. Download
🎉 What's new?
V 1.3.0
(July 16, 2020) Now, you can choose a package manager npm or yar. 💖
V 1.2.0
(July 15, 2020) Now, you can choose between JavaScript with EsLint setup and TypeScript with TsLint setup. 🎉🎆
📥 Installation
install the package globally with this command.
npm i -g new-express-app
⚙️ Usage
Run this command where you want to create the new app.
npx new-express-app
then answer the following Questions to configure your project:
? Enter Project Name:? Enter version:? Enter description:? Enter author name:? what language you want to use? # JavaScript or TypeScript ? choose a package Manager: # npm or yarn ? Want to initialise git?? Want to install dotEnv?? Want to install database driver? # MongoDB, Mongoose or None ? Want to initialise EsLint/Prettier? # if you chose JavaScript ? Want to initialise TsLint/Prettier? # if you chose TypeScript
🛠 Installed dependencies
Default Dependencies with JavaScript Setup
- Express
- cors
Default Dependencies with TypeScript Setup
- Express
- cors
- typescript
- ts-node
Optinal Dependencies
- dotenv
- mongoDB
- assert
- mongoose
Default devDependencies with JavaScript Setup
- nodemon
Default devDependencies with TypeScript Setup
- nodemon
- @types/node
- @types/express
- @types/cors
Optinal devDependencies
- EsLint / TsLint
- prettier
- required devDependencies for the past two devDependencies.
- @types/mongoose
- @types/mongodb
- @types/assert
📁 Folder structure
JavaScript Setup
.├── .env├── .eslintrc.json├── .gitignore├── package-lock.json├── package.json├── prettier.config.js└── src ├── controllers │ └── controller.js ├── index.js ├── models └── routes └── router.js 4 directories, 9 files
TypeScript Setup
.├── .env├── .gitignore├── .prettierrc.json├── package-lock.json├── package.json├── src│ ├── controllers│ │ └── controller.ts│ ├── index.ts│ ├── models│ └── routes│ └── router.ts├── tsconfig.json└── tslint.json 4 directories, 10 files
📄 Files Content
index.js
const express = ;const cors = ; const router = ; const app = ; app;app; app; app; app;
router.js
const express = ;const Controller = ; const router = express; router; moduleexports = router;
controller.js
exports { res;};
.eslintrc.json
prettier.config.js
moduleexports = tabWidth: 2 semi: true singleQuote: true trailingComma: 'es5';
🦾 Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
⚖ License
Copyright 2020 Mahmoud .A Mahmoud. Licensed under the MIT License