Skip to content

An Express API starter with some sample middleware and routes that you can deploy to AWS or Heroku

License

Notifications You must be signed in to change notification settings

karlpawlowicz/express-api-starter

Repository files navigation

Express API Starter CI

A simple Express API starter with some sample middleware and routes that you can deploy to AWS or Heroku. This starter also includes some basic configuration files and tests.

✨ Features

🚀 Quick Start

  1. Clone the repo.

    Clone the repo and run the onClone.js script.

    git clone https://github.com/karlpawlowicz/express-api-starter.git my-app && node my-app/scripts/onClone.js
  2. Install the dependencies.

    Move into the project directory and install the dependencies.

    cd my-app && npm install
  3. Run the server.

    Run the server in development mode. The server is now running at http://localhost:3001 and will reload if you make edits.

    npm start

🏗️ Project Structure

Initial project structure:

my-app
├── .github
├── .vscode
├── logs
├── node_modules
├── scripts
├── src
│   ├── middleware
│   ├── routes
│   │   ├── auth
│   │   └── health
│   └── utils
├── tests
│   ├── integration
│   ├── mockData
│   └── unit
├── .env
├── .eslintrc.js
├── .gitignore
├── .nvmrc
├── .prettierignore
├── .prettierrc.js
├── app.json
├── commitlint.config.js
├── CONTRIBUTING.md
├── ecosystem.config.js
├── jest.config.js
├── LICENSE
├── package-lock.json
├── package.json
├── Procfile
├── README.md
└── release.config.js
  1. /.github—this directory contains GitHub-related files.

  2. /.vscode—this directory contains the user and workspace settings file for VS Code.

  3. /logs—this directory contains the log files.

  4. /node_modules—this directory contains the project dependencies.

  5. /scripts—this directory contains the script files.

  6. /src—this directory contains the source code files.

  7. /tests—this directory contains the tests.

  8. .env—this file contains the environment variables.

  9. .eslintrc.js—this file contains the configuration for ESLint.

  10. .gitignore—this file tells Git which files to ignore.

  11. .nvmrc—this file tells nvm which version to use.

  12. .prettierignore—this file tells Prettier which files to ignore.

  13. .prettierrc.js—this file contains the configuration for Prettier.

  14. app.json—this file contains the manifest for this Heroku app.

  15. commitlint.config.js—this file contains the configuration for commitlint.

  16. CONTRIBUTING.MD—this file contains information about contributing.

  17. ecosystem.config.js—this file contains the configuration for PM2.

  18. jest.config.js—this file contains the configuration for Jest.

  19. LICENSE—this starter uses the MIT License.

  20. package-lock.json—this file is generated automatically by npm and contains the exact versions of the installed project dependencies.

  21. package.json—this file contains the manifest for this Node.js project.

  22. Procfile—this file contains the commands that are executed by the app on startup on Heroku.

  23. README.md—this file contains information about this project.

  24. release.config.js—this file contains the configuration for semantic-release.

🤖 Available Commands

In the project directory, you can run:

npm run format

Runs Prettier on css, js, json, jsx, md, scss, ts, and tsx file extensions.

npm run lint

Runs ESLint using the Airbnb JavaScript style guide. You will see any lint errors in the console.

npm run lint:fix

Runs ESLint and automatically fixes problems using the Airbnb JavaScript style guide. You will see any lint errors in the console.

npm run logs

Runs the server logs. You will see any server errors in the console.

npm run serve

Runs the server in production mode.

npm run serve:heroku

Runs the server without PM2.

npm start

Runs the server in development mode. The server is now running at http://localhost:3001 and will reload if you make edits.

npm stop

Stops the server.

npm test

Runs Jest. You will see the test results in the console.

npm run test:watch

Runs Jest in watch mode. You will see the test results in the console. Jest will rerun the tests if you make edits.

💫 Deploy

You can deploy this app to Heroku with the included Procfile, which will run the serve:heroku command after the dependencies finish installing.

Deploy

🤝 Contributing

See CONTRIBUTING.MD.

🧐 License

Licensed under the MIT License.

About

An Express API starter with some sample middleware and routes that you can deploy to AWS or Heroku

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published