Skip to content

Commit 4d0e154

Browse files
committed
refactor: group JavaScript examples as <lang>/<framework>/<database>
Required for #35
1 parent 7327df5 commit 4d0e154

File tree

9 files changed

+6
-5
lines changed

9 files changed

+6
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Generates the endpoints (or a whole app) from a mapping (SQL query -> URL)
4747
1. Generate code
4848
| Language | Command for code generation | Example of generated files | Libraries |
4949
| -----------| ----------------------------| ---------------------------| --------- |
50-
| JavaScript | `npx query2app --lang js` | [`app.js`](examples/js/app.js)<br/>[`routes.js`](examples/js/routes.js)<br/>[`package.json`](examples/js/package.json) | Web: [`express`](https://www.npmjs.com/package/express), [`body-parser`](https://www.npmjs.com/package/body-parser)<br>Database: [`mysql`](https://www.npmjs.com/package/mysql) |
50+
| JavaScript | `npx query2app --lang js` | [`app.js`](examples/js/express/mysql/app.js)<br/>[`routes.js`](examples/js/express/mysql/routes.js)<br/>[`package.json`](examples/js/express/mysql/package.json) | Web: [`express`](https://www.npmjs.com/package/express), [`body-parser`](https://www.npmjs.com/package/body-parser)<br>Database: [`mysql`](https://www.npmjs.com/package/mysql) |
5151
| Golang | `npx query2app --lang go` | [`app.go`](examples/go/chi/mysql/app.go)<br/>[`routes.go`](examples/go/chi/mysql/routes.go)<br/>[`go.mod`](examples/go/chi/mysql/go.mod) | Web: [`go-chi/chi`](https://github.com/go-chi/chi)<br/>Database: [`go-sql-driver/mysql`](https://github.com/go-sql-driver/mysql), [`jmoiron/sqlx`](https://github.com/jmoiron/sqlx) |
5252
| Python | `npx query2app --lang python` | [`app.py`](examples/python/fastapi/postgres/app.py)<br/>[`db.py`](examples/python/fastapi/postgres/db.py)<br/>[`routes.py`](examples/python/fastapi/postgres/routes.py)<br/>[`requirements.txt`](examples/python/fastapi/postgres/requirements.txt) | Web: [FastAPI](https://github.com/tiangolo/fastapi), [Uvicorn](https://www.uvicorn.org)<br/>Database: [psycopg2](https://pypi.org/project/psycopg2/) |
5353

examples/go/chi/mysql/endpoints.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../js/endpoints.yaml
1+
../../../js/express/mysql/endpoints.yaml
File renamed without changes.
File renamed without changes.

examples/js/package.json renamed to examples/js/express/mysql/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "js",
2+
"name": "mysql",
33
"version": "1.0.0",
44
"scripts": {
55
"start": "node app.js"
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../js/endpoints.yaml
1+
../../../js/express/mysql/endpoints.yaml

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"scripts": {
2929
"start": "node src/index.js",
3030
"test": "echo \"Error: no test specified\" && exit 1",
31-
"gen-js-example": "cd examples/js; ../../src/cli.js --lang js",
31+
"gen-js-example": "cd examples/js/express/mysql; ../../../../src/cli.js --lang js",
3232
"gen-go-example": "cd examples/go/chi/mysql; ../../../../src/cli.js --lang go",
3333
"gen-py-example": "cd examples/python/fastapi/postgres; ../../../../src/cli.js --lang python"
3434
},

src/cli.js

+1
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ const createDependenciesDescriptor = async (destDir, { lang }) => {
309309
`${__dirname}/templates/${fileName}.ejs`,
310310
{
311311
// project name is being used only for package.json
312+
// @todo #35 [js] Let a user to specify project name
312313
projectName
313314
}
314315
)

0 commit comments

Comments
 (0)