Skip to content

thebinaryfelix/create-iron-api

Repository files navigation

📦 create-iron-api

A simple base structure for designing a REST API.

This package creates a simple API demo, using as context an API that serves data about galaxies. If you wish to know more about this demo, you can check it out on @thebinaryfelix/galaxies-api-demo.

⚙️ Installation & Usage

$ npm init @thebinaryfelix/iron-api
# or
$ npx @thebinaryfelix/create-iron-api
# or
$ npm install -g @thebinaryfelix/create-iron-api
$ create-iron-api

Quick Start

Create the project with default name iron-api and install dependencies:

$ create-iron-api --yes --install

💡Use a custom folder name and install dependencies manually:

$ create-iron-api project-name
$ cd project-name
$ npm install

🚀 Run the created project

On project-name root folder

$ npm start

Open http://localhost:3000/api-docs to see API documentation.

🔴 Important

For this demo API to work properly, you need MongoDB Community Edition ^4.2 running on your machine.

Command Line Options

This generator can also be configured with the following flags.

-g, --git         initialize Git
-i, --install     install dependencies
-y, --yes         skip prompts

🧩 Project structure

iron-api/
├── api
│   ├── config
│   │   ├── swagger.js
│   ├── controllers
│   │   ├── galaxy.controller.js
│   ├── models
│   │   ├── galaxy.model.js
│   │   ├── response.model.js
│   ├── routes
│   │   ├── galaxy.routes.js
│   │   ├── index.js
│   ├── app.js
├── bin
│   ├── www
├── package.json
├── prettier.config.js
├── .prettierignore
├── .eslintrc.js
├── .eslintignore
├── .gitignore

🏆 References

🚧 Next steps

🧪 Tests

  • Add unitary tests to:
    • src/
      • cli.js
      • main.js
    • template/api
      • controllers/*
      • models/*
      • routes/*
      • app.js