Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rossoskull/generate-express-api
Generate Node.js and Express boilerplate API code
https://github.com/rossoskull/generate-express-api
Last synced: 18 days ago
JSON representation
Generate Node.js and Express boilerplate API code
- Host: GitHub
- URL: https://github.com/rossoskull/generate-express-api
- Owner: rossoskull
- Created: 2018-12-07T17:10:04.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-20T15:27:38.000Z (over 4 years ago)
- Last Synced: 2024-12-08T13:38:49.756Z (28 days ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/generate-express-api
- Size: 11.7 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## generate-express-api
[![npm](https://img.shields.io/npm/v/generate-express-api.svg)](https://www.npmjs.com/package/generate-express-api)
[![npm](https://img.shields.io/npm/dt/generate-express-api.svg)](https://www.npmjs.com/package/generate-express-api)
[![npm](https://img.shields.io/npm/l/generate-express-api.svg)](https://www.npmjs.com/package/generate-express-api)
#### To install
Copy the following command, and execute it in your terminal.
```sh
$ npm install -g generate-express-api
```#### To generate an API boilerplate
```sh
$ generate-api .
```
The above command will generate an Express + Node.js + MongoDB API boilerplate in the current working directory.
```sh
$ generate-api
```
The above command will generate an Express + Node.js + MongoDB API boilerplate in a new directory called .#### Installing
After the boilderplate is generated, cd into the directory, and run `npm install`
```sh
$ cd
$ npm install
```#### Running the server
After the installation is complete, you can run the server by using the following command.
```sh
$ npm start
```
If the environment variables are set, and a port is designated, the server will start at the designated port, else it will start at port 8000.#### Working with the API
Initially, API for Login and signup functionalities is readily available.
##### /register/
**Description** Registers a user with the given details
**Request type** POST
**Header body** { fname, lname, email, username, password }
**Response** A status code, and a response message.##### /register/username/
**Description** Checks if the username is already used.
**Request type** POST
**Header body** { username }
**Response** A status code, and a response message.##### /register/email
**Description** Checks if the email is already used.
**Request type** POST
**Header body** { email }
**Response** A status code, and a response message.##### /login/
**Description** Logs in a user with the given details.
**Request type** POST
**Header body** { username, password }
**Response** A status code, a response message and a JWT token.#### Made from scratch by Jay Mistry