-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2f6da07
Showing
11 changed files
with
4,601 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["@babel/preset-env"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
## Firstly let’s create a RESTful web server: | ||
|
||
## I navigate the cursor to the file I will create the project in the terminal and I am creating the package.json file with the following command: | ||
|
||
``` | ||
npm init --y | ||
``` | ||
|
||
## Now let’s add the packages that are necessary to create the server: | ||
|
||
``` | ||
npm install express cors morgan body-parser dotenv | ||
``` | ||
|
||
## let’s add the babel modules to the project: | ||
|
||
``` | ||
npm install @babel/core @babel/node @babel/preset-env | ||
``` | ||
|
||
## let’s create the .babelrc file and add the following code: | ||
|
||
``` | ||
{ | ||
“presets”: [“@babel/preset-env”] | ||
} | ||
``` | ||
|
||
## And finally, let’s add the following code to scripts field in the package.json file. | ||
|
||
``` | ||
"start": "nodemon — exec babel-node src/index.js" | ||
``` | ||
|
||
### If you don’t have nodemon in your PC, I advise installing it globally. | ||
|
||
``` | ||
sudo npm install -g nodemon | ||
``` | ||
|
||
## Adding Swagger to the project | ||
|
||
Firstly, let’s install two modules that are necessary for documentation and user interface (UI): | ||
|
||
``` | ||
npm install swagger-jsdoc swagger-ui-express | ||
``` | ||
|
||
## And I am importing these two modules in the index.js file: | ||
|
||
``` | ||
import swaggerUI from “swagger-ui-express”; | ||
import swaggerJsDoc from “swagger-jsdoc”; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"watch": ["src"] | ||
} |
Oops, something went wrong.
2f6da07
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deployment failed with the following error: