Skip to content

An api template starter with dynamic routes powered by Express

License

Notifications You must be signed in to change notification settings

Ysn4Irix/ex-api-template

Repository files navigation

gdrive


an express api starter template with dynamic routes, Powered by

express


star-repo

📟

❯ Usage

Requires Node.js 15.0 or higher download & install for Windows or Linux

# Recommended.
npx ex-api-cli --directory my-api-name

# OR an alternative global install.
npm install -g ex-api-cli

API includes

Server utilities:

  • Express
    • Fast, unopinionated, minimalist web framework for Node.js
  • helmet
    • Helmet helps you secure your Express apps by setting various HTTP headers. It's not a silver bullet, but it can help!
  • dotenv
    • Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env
  • cors
    • CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
  • response-time
    • response-time is a node.js package for creating a middleware that records the response time for requests in HTTP servers.
  • serve-favicon
    • serve-favicon is a node.js package for serving the favicon.
  • compression
    • compression is a node.js package for compressing response bodies.
  • http-status-code
    • Constants enumerating the HTTP status codes. Based on the Java Apache HttpStatus API.
  • signale
    • signale is a Hackable and configurable to the core, signale can be used for logging purposes, status reporting, as well as for handling the output rendering process of other node modules and applications.

Development utilities:

  • nodemon
    • nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.
  • @types/express
    • @types/express is a node.js package that contains type definitions for Express.js.
  • @types/node
    • @types/node is a node.js package that contains type definitions for Node.js.
  • prettier
    • Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

Setup

pnpm install

# OR
npm install

Format

pnpm run format

# OR
npm run format

Development

pnpm run dev

# OR
npm run dev

⚙️

❯ Project structure

ex-api-template
│   .env.example
│   .prettierrc
│   .gitignore
│   Dockerfile
│   LICENCE
│   package.json
│   pnpm-lock.yaml
│   README.md
│   server.js
│
├───.github
│──────workflows
│           release.yml
├───.vscode
│       extensions.json
├───controllers
│       main.controller.js
│
├───helpers
│       apiResponse.js
│       logger.js
│
├───middlewares
│       notFoundHandler.js
│
└───routes
        healthcheck.js
        index.js

🙌

❯ Contributing

Pull requests and stars are always welcome. For bugs and features requests, please create an issue.


star-repo


📃

❯ License

Copyright © 2023-present, Ysn4Irix. Released under the MIT License.