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.
$ npm init @thebinaryfelix/iron-api
# or
$ npx @thebinaryfelix/create-iron-api
# or
$ npm install -g @thebinaryfelix/create-iron-api
$ create-iron-api
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
On project-name
root folder
$ npm start
For this demo API to work properly, you need MongoDB Community Edition ^4.2 running on your machine.
This generator can also be configured with the following flags.
-g, --git initialize Git
-i, --install install dependencies
-y, --yes skip prompts
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
- How to build a CLI with Node.js - by Dominik Kundel
- express-generator
- @thebinaryfelix/galaxies-api-demo
- Add unitary tests to:
- src/
- cli.js
- main.js
- template/api
- controllers/*
- models/*
- routes/*
- app.js
- src/