1.0.2 โ€ข Published 5 years ago

@thebinaryfelix/create-iron-api v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

๐Ÿ“ฆ 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