UNPKG

express-simplicity

Version:

ExpressSimplicity is a unique and descriptive npm package that revolutionizes Express.js development. This comprehensive toolkit provides an intuitive and streamlined approach to building robust web applications with Express.js.

80 lines (59 loc) 3.22 kB
# Express Simplicity: Default Folder Structure And Essential Packages For Express.js Jumpstart your Express.js and Node.js projects with the Express.js Starter Kit. This npm package provides a default folder structure and installs essential npm packages to help you quickly set up and build robust web applications. <div align="center"> <img src="./media/image.png" width="500px" align="center"> </div> ## :point_right: Key Features - **Organized Folder Structure**: The Express.js Starter Kit creates a predefined folder structure with neatly organized directories for routes, controllers, models, views, and public assets. - **Pre-configured Express.js Server**: Get started right away with a basic Express.js server that comes pre-configured with routing and error handling. - **Essential NPM Packages**: Save time and effort by having commonly used npm packages for Express.js, such as nodemon, express, and dotenv, automatically installed. These packages enhance security and streamline your development process. - **Best Practices and Sample Code**: The Starter Kit includes sample code and configuration files that follow best practices, allowing you to start building your application immediately. ## :point_right: Requirements * `Node js` should be installed. * `npm` or `yarn` should be installed. ## :point_right: Installation To get started, * Install the Express Simplicity Starter Kit globally using npm: ```bash npm install -g express-simplicity ``` * Then open your terminal and navigate to your folder where you wont to install the template ```bash cd < path to the project directory > ``` * After navigating to the folder run this command it will generate the files and install the dependencies. ```bash express-simplicity ``` * After generating the files run this command to start the server. ```bash npm run express ``` * Move on to your preferred browser and paste this URL. ```bash http://localhost:3000/ ``` ## :point_right: Packages * `dotenv`: Loads environment variables from a .env file into process.env. * `nodemon`: Automatically restarts the Node.js application when changes are detected in the source code. * `express`: A web framework for Node.js that simplifies the process of building web applications. you can access the api routes similarly. * `mysql`: The MySQL Node package: Simplifying MySQL database interactions in Node.js. ## :point_right: Additional Comments * Change the `env-example.txt` file to `.env` to enable the usage of environment variables in your project. * I have added some boilerplate code in the controllers, models and routes folder. I have use the `MVC architecture` in this. ```bash http://localhost:3000/api/users http://localhost:3000/api/users/5 ``` * To connect this application to the database you can replace these .env variables with your db credentials. ```bash DB_HOST= DB_USERNAME= DB_PASSWORD="" DB_NAME= # If you are getting any unexpected errors you can add the socket path to SOCKET_PATH= ``` * I have added comments on the `userModels` files and the `userController` file on how to get data from the database once the db is connected. ## :point_right: License The Express.js Starter Kit is licensed under the ISC License.