You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 20, 2020. It is now read-only.
to start using the package, create a new instance of the NodeBlog class
39
+
to start using the package, create a new blog object:
40
40
41
41
```js
42
42
constclient='YOUR_DB_CLIENT'; // for more info, see https://knexjs.org/
@@ -99,11 +99,11 @@ articles.delete(blog, id)
99
99
100
100
We recommend creating a single file that will create the NodeBlog instance, and `export` this instance, and `import` in all other files where you want to use NodeJS Blog.
101
101
102
-
For security reasons we recommend using environment variables for loading the configuration. This is also in compliance with the [12 factor app Config guidelines](https://12factor.net/config)
102
+
For security reasons we recommend using environment variables for loading the configuration. This is also in compliance with the [12 factor app Config guidelines](https://12factor.net/config).
103
103
104
104
Note: NodeJS blog was made to be used with PostgreSQL, but it should(/could) also be compatible with other databases, as it uses [KnexJS](https://knexjs.org) under the hood.
105
105
106
-
*A demo application is currently in development*
106
+
*A demo application and a standalone CLI are currently in development*
107
107
108
108
## Running the API as a standalone service (still in development, might not work 100%)
109
109
@@ -124,6 +124,7 @@ For development, the following commands are available:
124
124
| Command | Functionality |
125
125
| - | - |
126
126
|`yarn run dev`| Runs a `nodemon` server for the `server/server.js` file, and exposing the standalone service to your `localhost`|
127
+
|`yarn run cli`| Runs the CLI tool created for simple CRUD operations without accessing the database directly |
127
128
|`yarn run lint`| Runs ESLint, for PRs this should always pass |
128
129
|`yarn run test`| Runs Jest once, for PRs this should always pass. Your database must be available as it is used to run tests on (beware: all existing data will be wiped, we recommend using a separate test-database, this can be set in the `.env` file) |
129
130
|`yarn run test:watch`| Same as `yarn run test`, but it Jest watches for changes |
@@ -132,26 +133,6 @@ For development, the following commands are available:
132
133
|`yarn run reinstall`| Deletes the `node_modules/` folder and reinstalls everything, if you get some stange dependency errors, run this command |
133
134
|`yarn run clean`| Deletes folders `build/`, `dist/` and `coverage/`|
134
135
135
-
### Folder structure
136
-
137
-
```md
138
-
.
139
-
├── controllers Controllers for the module based API
140
-
├── database All database related files
141
-
│ ├── migrations
142
-
│ └── seeds
143
-
├── helpers Helper files, for example: logger, database instance
144
-
├── server
145
-
│ ├── controllers
146
-
│ ├── middleware
147
-
│ │ └── modules
148
-
│ └── routes
149
-
├── src Source directory for the API exposed by the module
0 commit comments