Skip to content

Commit 88e582a

Browse files
committed
Cleanup of READMEs prior to tag
1 parent 6c6749a commit 88e582a

2 files changed

Lines changed: 32 additions & 20 deletions

File tree

README.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
# Generating API
22

3-
To generate the API first download swagger-codegen () and build it. After its built, create an alias:
4-
alias swagger-codegen='java -jar [/path/to/built/swagger-codegen]/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar'
3+
To generate the API first download [swagger-codegen](https://github.com/swagger-api/swagger-codegen) and build it. After its built, create an alias:
54

6-
To rebuild the JSON API spec due to YAML changes (required for docs UI to be accurate): `generate -i swagger.yaml -o ./generated-json -l swagger`
5+
`alias swagger-codegen='java -jar [/path/to/built/swagger-codegen]/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar'`
76

8-
To build the server stub (node): `swagger-codegen generate -i swagger.yaml -o ./server/generated-server -l nodejs-server`
7+
##Generating the JSON Spec
8+
Anytime the root swagger.yaml is modified the JSON spec should be updated and copied into
9+
`swagger-ui/dist/swagger-spec.js` as the value for the `swaggerSpec` var. Currently this is a manual process.
910

10-
To build the client (typescript): `swagger-codegen generate -i swagger.yaml -o ./client/generated-client -l typescript-node`
11+
To regenerate the JSON API spec due to YAML changes (required for docs UI to be accurate): `generate -i swagger.yaml -o ./generated-json -l swagger`.
12+
The generated JSON can be deleted after its been copied to `swagger-spec.js`.
1113

12-
The API can be built for a number of other languages as well but you will need to manually port the business logic from the existing nodesjs-server \
13-
API to the languages of your choice. We encourage anyone who does this to submit a pull request to have their server API added to the official repo.
14+
##Generating Server Stubs
15+
You can contribute to the syscoin-api project by writing connectors for Syscoin in different languages.
16+
Swagger-codegen can greatly reduce the time it takes to write connectors in other languages by generating a server-api stub
17+
in the desired language. To generate the Server stub use the command below replacing LANGUAGE with one of the [supported SwaggerJS server values](https://github.com/swagger-api/swagger-codegen/wiki/Server-stub-generator-HOWTO).
1418

19+
To build the server SDK stub: `swagger-codegen generate -i swagger.yaml -o ./server/generated-server -l LANGUAGE`
20+
21+
We encourage anyone who does this to submit a pull request to have their server API added to the official repo.
1522
Package your server API using folder names mirroring the swagger language name, ie: 'nodejs-server'. Client API's can also be submitted using the same \
16-
format.
23+
format.
24+
25+
##Generating the Client SDK
26+
To quickly start communicating with an instance of the Syscoin API server simply generate a client-side SDK
27+
in your preferred language. To generate the Client SDK use the command below replacing LANGUAGE with one of
28+
the [supported SwaggerJS client values](https://generator.swagger.io/#!/clients/clientOptions).
29+
30+
To build the client: `swagger-codegen generate -i swagger.yaml -o ./client/generated-client -l LANGUAGE`

server/nodejs/README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
# Swagger generated server
2-
3-
## Overview
4-
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. This is an example of building a node.js server.
5-
6-
This example uses the [expressjs](http://expressjs.com/) framework. To see how to make this your own, look here:
7-
8-
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
9-
10-
### Running the server
1+
## Running the server
112
To run the server, follow these simple steps:
123

134
```
145
npm install
156
npm run start
167
```
178

18-
### Running the server in daemon mode
19-
To run the server as a daemon use the below command after `npm install` completes:
9+
## Running the server in daemon mode
10+
Running the server in daemon mode is dependent on [pm2](https://www.npmjs.com/package/pm2). To run the server as a daemon use the below command after `npm install` completes:
2011

2112
```
2213
npm run startd
2314
```
2415

16+
## Configuring for Production Use
17+
Before deploying syscoin-api for production use you will need to modify the `swaggerSpec.host` value located in `../../swagger-ui/dist/swagger-spec.js` from
18+
`localhost:8001` to `SERVERIP:8001`. Replacing SERVERIP with your server's production IP or domain. You can also optionally change the port. It is highly recommended that you
19+
allow only HTTPS access in production and secure connections with a valid SSL certificate.
20+
21+
22+
### Credits
2523
This project leverages the mega-awesome [swagger-tools](https://github.com/apigee-127/swagger-tools) middleware which does most all the work.

0 commit comments

Comments
 (0)