The simplest and most practical Node.js backend template, suitable for quickly setting up small-scale backends.
最爽的方式起个 Nodejs 小后端
pnpm i
pnpm dev
All db operations are in db.js
. And data is under ./data
db_connect
to create and connect dbdb_insert
to add datadb_find
to return array of datadb_remove
to remove data
How to export the data to json?
export.js
to modifyname
variable andpnpm export
You can write backend APIs in api.js
And socket APIs in socket_api.js
All sessions store under the ./sessions
Please place all static files under ./public
. And use url /static/...
to access.
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
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.
You can use it like template repo into new repos.