Skip to content

Commit e0d4207

Browse files
committed
[Prerelease] Bumped version number
1 parent 53196bb commit e0d4207

File tree

4 files changed

+137
-1
lines changed

4 files changed

+137
-1
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
<a name="0.3.1"></a>
2+
## [0.3.1](https://github.com/EnsembleLab/api-template/compare/0.3.0...0.3.1) (2017-10-18)
3+
4+
5+
16
<a name="0.3.0"></a>
27
# [0.3.0](https://github.com/EnsembleLab/api-template/compare/0.2.0...v0.3.0) (2017-09-13)
38

docs/index.md

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Express REST API Generator
2+
3+
[![Build Status](https://travis-ci.org/iolufemi/Express-REST-API-Generator.svg?branch=dev)](https://travis-ci.org/iolufemi/Express-REST-API-Generator) [![codecov](https://codecov.io/gh/iolufemi/Express-REST-API-Generator/branch/master/graph/badge.svg)](https://codecov.io/gh/iolufemi/Express-REST-API-Generator) [![Documentation Status](https://readthedocs.org/projects/express-rest-api-generato/badge/?version=latest)](http://express-rest-api-generato.readthedocs.io/en/latest/?badge=latest)
4+
5+
Express REST API Generator is an Express Based API skeleton. A template for starting projects with express as an API. This project can be used for creating a RESTful API using Node JS, Express as the framework and Mongoose to interact with a MongoDB instance. Mocha is also used for running unit tests in the project.
6+
7+
The resulting API from this project is a JSON REST API which will respond to requests over HTTP. REST Clients can, therefore, connect to the resulting REST server.
8+
9+
## What is API?
10+
11+
In computer programming, an application programming interface (API) is a set of clearly defined methods of communication between various software components. A good API makes it easier to develop a computer program by providing all the building blocks, which are then put together by the programmer. An API may be for a web-based system, operating system, database system, computer hardware or software library. Just as a graphical user interface makes it easier for people to use programs, application programming interfaces make it easier for developers to use certain technologies in building applications. - [Wikipedia](https://en.wikipedia.org/wiki/Application_programming_interface)
12+
13+
## What is REST?
14+
15+
Representational state transfer (REST) or RESTful web services is a way of providing interoperability between computer systems on the Internet. REST-compliant Web services allow requesting systems to access and manipulate textual representations of Web resources using a uniform and predefined set of stateless operations. - [Wikipedia](https://en.wikipedia.org/wiki/Representational_state_transfer)
16+
17+
> NOTE: The use of this project requires that you have a basic knowledge of using express in building a REST API. If you are a newbie, here are some awesome tutorials to get you started.
18+
19+
- [Build Node.js RESTful APIs in 10 Minutes](https://www.codementor.io/olatundegaruba/nodejs-restful-apis-in-10-minutes-q0sgsfhbd)
20+
- [Easily Develop Node.js and MongoDB Apps with Mongoose](https://scotch.io/tutorials/using-mongoosejs-in-node-js-and-mongodb-applications)
21+
- [Build a RESTful API Using Node and Express 4](https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4)
22+
23+
## Why use Express REST API Generator?
24+
25+
1. To enable you to develop REST APIs in the fastest way possible.
26+
2. To encourage endpoint versioning.
27+
3. To encourage unit testing and make it super easy to get started with writing unit tests by generating basic unit tests for generated components.
28+
4. To enforce best practice in writing javascript apps by using lint.
29+
5. To encourage good code file structure that can be easily followed by other team members, especially new team members.
30+
6. To make it easy to build secure APIs with the ability to communicate with the frontend in an encrypted fashion.
31+
7. To encourage backing up of deleted data.
32+
8. To encourage logging API requests and responses for audit purposes.
33+
9. To encourage proper Error handling and logging.
34+
10. To encourage a uniform API response format across teams.
35+
11. To make it easy to write asynchronous logic and applications using the inbuilt distributed job queue.
36+
37+
## Installation
38+
39+
To start your project with Express REST API Generator, clone the repository from GitHub and install the dependencies.
40+
41+
```
42+
$ git clone https://github.com/iolufemi/Express-REST-API-Generator.git ./yourProjectName
43+
$ cd yourProjectName
44+
$ npm install
45+
$ npm install -g mocha gulp
46+
```
47+
48+
Then generate your first API endpoint
49+
50+
```
51+
$ gulp service --name yourFirstEndpoint // This command will create a CRUD endpoint for yourFirstEndpoint.
52+
```
53+
54+
Try out your new endpoint.
55+
56+
Start the app
57+
58+
```
59+
$ npm start
60+
```
61+
by default, the app will start on `POST 8080`
62+
63+
You can change the PORT by adding a `PORT` environment variable.
64+
eg.
65+
66+
```
67+
$ PORT=6000 npm start
68+
```
69+
now the app will start on `PORT 6000`
70+
71+
To start the app for development, run
72+
73+
```
74+
$ gulp
75+
```
76+
This will automatically restart your app whenever a change is detected.
77+
78+
You will now be able to access CRUD (create, read, update and delete) endpoints
79+
80+
`[POST] http://localhost:8080/yourFirstEndpoint` Create yourFirstEndpoint resources
81+
`[GET] http://localhost:8080/yourFirstEndpoint` Get yourFirstEndpoint resources. Supports limits, sorting, pagination, select (projection), search and date range
82+
`[GET] http://localhost:8080/yourFirstEndpoint/:id` Get a yourFirstEndpoint resource
83+
`[PUT] http://localhost:8080/yourFirstEndpoint` Update yourFirstEndpoint resources
84+
`[PATCH] http://localhost:8080/yourFirstEndpoint/:id` Update one yourFirstEndpoint resource
85+
`[DELETE] http://localhost:8080/yourFirstEndpoint?key=value` Delete yourFirstEndpoint resources
86+
`[DELETE] http://localhost:8080/yourFirstEndpoint/:id` Delete one yourFirstEndpoint resource
87+
`[POST] http://localhost:8080/yourFirstEndpoint/:id/restore` Restore a previously deleted yourFirstEndpoint resource
88+
89+
## Versioning your API endpoints
90+
91+
You can create multiple versions of your API endpoints by simply adding the version number to your route file name. eg. `users.v1.js` will put a version of the users resources on the `/v1/users` endpoint. users.v2.js will put a version of the users resources on the `/v2/users` endpoint. The latest version of the resources will always be available at the `/users` endpoint.
92+
93+
> NOTE: This project will automatically load route files found in the routes folder.
94+
95+
## File Structure
96+
97+
- config
98+
- controllers
99+
- models
100+
- routes
101+
- services
102+
- templates
103+
- test
104+
105+
## Getting support, Reporting Bugs and Issues
106+
107+
If you need support or want to report a bug, please log an issue [here](https://github.com/iolufemi/Express-REST-API-Generator/issues)
108+
109+
## Running Unit Tests
110+
111+
All generated endpoints come with complete test suits, we encourage you to update the tests as you extend the logic
112+
113+
```
114+
$ npm test
115+
```
116+
117+
## How to contribute
118+
119+
View how to contribute [here](https://github.com/iolufemi/Express-REST-API-Generator/blob/master/CONTRIBUTING.md)
120+
121+
## Code of Conduct
122+
123+
View the code of conduct [here](https://github.com/iolufemi/Express-REST-API-Generator/blob/master/CODE_OF_CONDUCT.md)
124+
125+
## Contributors
126+
127+
- [Olufemi Olanipekun](https://github.com/iolufemi)
128+
129+
## FAQs

mkdocs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
site_name: Express REST API Generator Documentation
2+
theme: readthedocs

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "api-template",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "A template for creating APIs Fast",
55
"main": "app.js",
66
"scripts": {

0 commit comments

Comments
 (0)