https://github.com/lehaolin/mozi
The simplest and most practical Node.js backend template, suitable for quickly setting up small-scale backends. | 最爽的方式起个Nodejs小后端
https://github.com/lehaolin/mozi
backend express nedb nodejs restful session-file-store
Last synced: 8 months ago
JSON representation
The simplest and most practical Node.js backend template, suitable for quickly setting up small-scale backends. | 最爽的方式起个Nodejs小后端
- Host: GitHub
- URL: https://github.com/lehaolin/mozi
- Owner: LehaoLin
- License: mit
- Created: 2023-11-07T11:35:54.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-09T10:56:13.000Z (over 2 years ago)
- Last Synced: 2025-04-27T10:45:50.147Z (about 1 year ago)
- Topics: backend, express, nedb, nodejs, restful, session-file-store
- Language: JavaScript
- Homepage:
- Size: 93.8 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
The simplest and most practical Node.js backend template, suitable for quickly setting up small-scale backends.
最爽的方式起个 Nodejs 小后端
## Run the project
`pnpm i`
`pnpm dev`
## DB: NEDB
All db operations are in `db.js`. And data is under `./data`
- `db_connect` to create and connect db
- `db_insert` to add data
- `db_find` to return array of data
- `db_remove` to remove data
How to export the data to json?
- `export.js` to modify `name` variable and `pnpm export`
## API
You can write backend APIs in `api.js`
And socket APIs in `socket_api.js`
## Session
All sessions store under the `./sessions`
## Static File
Please place all static files under `./public`. And use url `/static/...` to access.
## Full stack Development
`pnpm vue`
It will create a frontend dir with a Vue Vite project named `frontend`.
And you should modify the `api.js` to cancel the comment code beside `// for vue project inside`
## Run Python file
All Python files should be under `pyscript`.
Run shell `setup.sh` to setup the python enviroment.
And please write python functions in `server.py`
To call the function, write in the `api.js` use the `call_py()` function.
## Template Code
You can use it like template repo into new repos.