1
-
2
- ![ NodeJS logo] ( logo.png )
1
+ ![ NodeJS logo] ( logo.png )
3
2
4
3
## Node API
5
4
6
5
### Description
6
+
7
7
Node API is production ready and open source project in Node, Express and MongoDB
8
8
9
9
### Support
10
+
10
11
This application is hosted on Heroku and serve a bunch of AJAX requests to give and manipulate data from database and give a support to test front end applications
11
12
12
13
### Servers
13
14
14
- | Server | Description | Api Url | Branch (GitHub) |
15
- | ------ | ------ | ------ | ------ |
16
- | staging | Open Api | https://rest-api-node.herokuapp.com | master
17
- | production | Authenticated Api | https://rest-api-node-production.herokuapp.com | production
15
+ | Server | Description | Api Url | Branch (GitHub) |
16
+ | ---------- | ----------------- | ---------------------------------------------- | --------- ------ |
17
+ | staging | Open Api | https://rest-api-node.herokuapp.com | master |
18
+ | production | Authenticated Api | https://rest-api-node-production.herokuapp.com | production |
18
19
19
20
### Showcase
20
21
21
- | Application | Code (GitHub) | Server
22
- | ------ | ------ | ------ |
23
- | https://typescript-angular4.herokuapp.com/ | https://github.com/renanlopescoder/typescript-angular4 | staging
24
- | http://mobx-react.herokuapp.com/ | https://github.com/renanlopescoder/mobx-react | staging
25
-
22
+ | Application | Code (GitHub) | Server |
23
+ | ------------------------------------------ | ------------------------------------------------------ | ------- |
24
+ | https://typescript-angular4.herokuapp.com/ | https://github.com/renanlopescoder/typescript-angular4 | staging |
25
+ | http://mobx-react.herokuapp.com/ | https://github.com/renanlopescoder/mobx-react | staging |
26
26
27
27
## Routes
28
28
29
29
#### Projects
30
- | URL | Collection | Method | Parameters | Response | Action |
31
- | ------ | ------ | ------ | ------ | ------ | ------ |
32
- | https://rest-api-node.herokuapp.com/projects | projects | get | Nothing | JSON with Array | Get a list of projects in the database |
33
- | https://rest-api-node.herokuapp.com/projects/create | projects | post | JSON | JSON | Add JSON into the database |
34
- | https://rest-api-node.herokuapp.com/projects/update/:id | projects | put | id, JSON | Update the document with sent JSON data |
35
- | https://rest-api-node.herokuapp.com/projects/select/:id | projects | get | id | JSON | Return the document, related to the sent id |
36
- | https://rest-api-node.herokuapp.com/projects/delete/:id | projects | delete | id | status 200 | Delete the document, related to the sent id |
30
+
31
+ | URL | Collection | Method | Parameters | Response | Action |
32
+ | ------------------------------------------------------- | ---------- | ------ | ---------- | --------------------------------------- | ------------------------------------------- |
33
+ | https://rest-api-node.herokuapp.com/projects | projects | get | Nothing | JSON with Array | Get a list of projects in the database |
34
+ | https://rest-api-node.herokuapp.com/projects/create | projects | post | JSON | JSON | Add JSON into the database |
35
+ | https://rest-api-node.herokuapp.com/projects/update/:id | projects | put | id, JSON | Update the document with sent JSON data |
36
+ | https://rest-api-node.herokuapp.com/projects/select/:id | projects | get | id | JSON | Return the document, related to the sent id |
37
+ | https://rest-api-node.herokuapp.com/projects/delete/:id | projects | delete | id | status 200 | Delete the document, related to the sent id |
37
38
38
39
#### Users
39
- | URL | Collection | Method | Parameters | Response | Action |
40
- | ------ | ------ | ------ | ------ | ------ | ------ |
41
- | https://rest-api-node.herokuapp.com/users | users | get | Nothing | JSON with Array | Get a list of users in the database |
42
- | https://rest-api-node.herokuapp.com/users/create | users | post | JSON | JSON | Add JSON into the database |
43
- | https://rest-api-node.herokuapp.com/users/update/:id | users | put | id | JSON | Update the document with sent JSON data |
44
- | https://rest-api-node.herokuapp.com/users/select/:id | users | get | id | JSON | Return the document, related to the sent id |
45
- | https://rest-api-node.herokuapp.com/users/delete/:id | users | delete | id | status 200 | Delete the document, related to the sent id |
40
+
41
+ | URL | Collection | Method | Parameters | Response | Action |
42
+ | ---------------------------------------------------- | ---------- | ------ | ---------- | --------------- | ------------------------------------------- |
43
+ | https://rest-api-node.herokuapp.com/users | users | get | Nothing | JSON with Array | Get a list of users in the database |
44
+ | https://rest-api-node.herokuapp.com/users/create | users | post | JSON | JSON | Add JSON into the database |
45
+ | https://rest-api-node.herokuapp.com/users/update/:id | users | put | id | JSON | Update the document with sent JSON data |
46
+ | https://rest-api-node.herokuapp.com/users/select/:id | users | get | id | JSON | Return the document, related to the sent id |
47
+ | https://rest-api-node.herokuapp.com/users/delete/:id | users | delete | id | status 200 | Delete the document, related to the sent id |
46
48
47
49
## Collections
48
50
49
51
#### Schema Project (projects)
50
52
51
- | Name | Description | Type |
52
- | ------ | ------ | ------ |
53
- | project | project name | String |
54
- | technologies | project technologies | String |
55
- | description | project description | String |
56
- | demoLink | demo link | String |
57
- | githubLink | GitHub link | String |
58
- | author | author's name | String |
59
- | authorLink | links to author (website, linkedin) | String |
60
- | project | project name | String |
61
- | status | project status (Development / Production) | String |
53
+ | Name | Description | Type |
54
+ | ------------ | ----------------------------------- ------ | ------ |
55
+ | project | project name | String |
56
+ | technologies | project technologies | String |
57
+ | description | project description | String |
58
+ | demoLink | demo link | String |
59
+ | githubLink | GitHub link | String |
60
+ | author | author's name | String |
61
+ | authorLink | links to author (website, linkedin) | String |
62
+ | project | project name | String |
63
+ | status | project status (Development / Production) | String |
62
64
63
65
#### Schema User (users)
64
66
65
- | Name | Description | Type |
66
- | ------ | ------ | ------ |
67
- | username | user name | String |
67
+ | Name | Description | Type |
68
+ | -------- | -------------- ------ | ------ |
69
+ | username | user name | String |
68
70
| password | user password (hash) | String |
69
- | email | user mail | String |
70
- | photo | user photo | String |
71
- | nickname | user nickname | String |
71
+ | email | user mail | String |
72
+ | photo | user photo | String |
73
+ | nickname | user nickname | String |
72
74
73
75
## API
74
76
75
- | Technology | Description | Link |
76
- | ------ | ------ | ------ |
77
- | Heroku | Cloud Platform | [ heroku.com] |
78
- | Heroku mLab Dyno | MongoDB database server | [ mlab.com] |
79
- | GitHub | Version Controlling | [ github.com] |
80
- | PM2 | server reload, automatically | [ pm2.com] |
77
+ | Technology | Description | Link |
78
+ | ---------------- | ----------------------- | ------------ |
79
+ | Heroku | Cloud Platform | [ heroku.com] |
80
+ | Heroku mLab Dyno | MongoDB database server | [ mlab.com] |
81
+ | GitHub | Version Controlling | [ github.com] |
81
82
82
83
## API Directories
83
84
84
- - Routes ``` ./src/routes ```
85
- - Models ``` ./src/models ```
86
- - Actions ``` ./src/actions ```
87
- - Services ``` ./src/services ```
88
- - Configurations of Express ``` ./config/express.js ```
89
- - Database configurations ``` ./config/database.js ```
90
- - Server configurations ``` ./server.js ```
85
+ - Routes ` ./src/routes `
86
+ - Models ` ./src/app/Models `
87
+ - Controllers ` ./src/app/Controllers `
88
+ - Services ` ./src/app/Services `
89
+ - Config consign and express ` ./src/config/express.js `
90
+ - Server configuration and application startup ` ./server.js `
91
91
92
92
## Configuring the API locally
93
93
94
94
- Download or clone the project access the project folder with the terminal and execute the CLI <code >npm install</code >
95
- - Config your database in ``` ./congig/database.js ``` change ``` mongoose.connect('mongodb://localhost/yourDatabaseName'); ```
96
- - Run the server in development mode <code >npm run dev</code >
97
- - <code >Ctrl + c</code > to exit of logs and run <code >pm2 kill</code > to kill all process of pm2
95
+ - To change database change on constants the databaseUrl
96
+ - Run the server <code >npm start</code >
98
97
- Access in your browser <a href =" http://localhost:3000/projects " >http://localhost:3000/projects </a >
99
98
100
99
## API Dependencies
@@ -103,12 +102,10 @@ This application is hosted on Heroku and serve a bunch of AJAX requests to give
103
102
- Dependency body-parser - <a href =" https://www.npmjs.com/package/body-parser " >https://www.npmjs.com/package/body-parser </a >
104
103
- Dependency cors - <a href =" https://www.npmjs.com/package/cors " >https://www.npmjs.com/package/cors </a >
105
104
- Dependency consign - <a href =" https://www.npmjs.com/package/consign " >https://www.npmjs.com/package/consign </a >
106
- - Dependency PM2 - <a href =" http://pm2.keymetrics.io/ " >http://pm2.keymetrics.io/ </a >
107
105
- Dependency mongoose - <a href =" https://www.npmjs.com/package/mongoose " >https://www.npmjs.com/package/mongoose </a >
108
106
109
107
By: <a href =" http://renanlopes.com " >Renan Lopes</a >
110
108
111
- [ heroku.com ] : < https://www.heroku.com >
112
- [ mlab.com ] : < https://mlab.com >
113
- [ github.com ] : < https://www.github.com >
114
- [ pm2.com ] : < http://pm2.keymetrics.io/ >
109
+ [ heroku.com ] : https://www.heroku.com
110
+ [ mlab.com ] : https://mlab.com
111
+ [ github.com ] : https://www.github.com
0 commit comments