The Express framework is a popular framework in the NodeJs community. It powers many applications on the internet and it is loved by many because of its simplicity, it is less opinionated, and the ability to develop APIs quickly.
Setting up a new project for a medium-sized application could be time-consuming with the Express framework because it is a minimalist framework, but there is a new tool that can speed up the setup process of a new express project. The new tool is called express-api-cli, With the express-api-cli tool, you can start a new project with just three short words on your command line terminal and your project is immediately ready for development
Express api cli allows you to create a new project within minutes with little or no configuration. You create your project and you start developing your business logic right away.
How to get started
- Ensure you have NodeJs and NPM installed on your computer
- Open your command-line tool and run npm install -g express-api-cli command – this installs the express-api-cli globally on your computer.
- To create a new project run exp-api create awesome-project. Replace awesome-project with the name of your project
- Follow the instructions to select the type of project you want to create.
- Voila, your project is ready for development !!!
Note:
For more express-api-cli Commands visit https://www.npmjs.com/package/express-api-cli
Features of express-api-cli
- Express-api-cli generated project contains packages that have been configured to ensure you don’t need to waste extra time configuring them. These packages have been carefully selected and configured to ensure that your application is robust. Express-api-cli generated project contains the following packages
- Typescript – Typescript is a superset of javascript that adds optional static typing to javascript. During project creation, you are requested to select either Javascript or Typescript, if you select Typescript, it will be installed and configured in your project, if you don’t it will not be configured.
- Mongoose – Mongoose is a MongoDB Object Data Modelling Library. It manages communication between your project and your MongoDB database, it also provides schema validation, etc. Mongoose provides a lot of out of the box features to ensure that communication with your database is seamless. It is also optional during installation.
- Sequelize – Sequelize is an Object Relational Mapping framework for MySql, Postgres, SQLite, and Microsoft SQL Server. It provides seamless communication with the aforementioned databases. Note: During the creation of a new project, you either select Mongoose or Sequelize
- Validation – Validation is readily configured in the project to validate incoming requests. Validation is made available by @hapi/joi
- Exception Middleware – There is a centralized exception middleware to handle all forms of errors in your project.
- Logging – Logging errors in an api application is very important, in an express-api-cli generated project all incoming requests and error exceptions are logged in a log folder. This ensures that debugging is made easy when your project goes live. Logging is made available thanks to Winston and Morgan
- Security – With the help of Helmet and cors, your project there as an added level of security Integrated into your project
- Authentication – Express-api-cli uses JsonWebToken to provide authentication in your project
- Test environment – Testing suites have been packaged with the express-api-cli project and readily configured. All you just need to do is to start writing tests right away. The following make up the test suite
- Code Formatting – A codebase with ugly formatting is difficult to read and understand. Also working in a team with different formatting rules configured on each co-worker machine can be frustrating, because each co-worker will reformat the codebase based on the machine prettier formatting configuration. To mitigate this, express-api-cli comes with a configured eslint and prettier rules, to ensure there is uniformity in the project
- Set up a new project in less than 5 minutes
- Generate controller, router, service files right from the command line
- Well formatted and clean code structure
Speed up your new project setup with the express-api-cli tool
Advantages of using the express-api-cli
- Start a new project faster with pre-configured packages
- Reduce time taken to configure your project
- Express-api-cli allows you to generate different files for different parts of your project such as (controller, services, routes, test), etc
Express-api-cli is an awesome tool for every Express Developer.
When next you have a new project, set it up using the express-api-cli tool so that you don’t waste time in the configuration process
Cheers!!!
2 Comments