Server for blogs using Valaxy
- Install dependencies
pnpm i
- Config the server
Create file
.env
in root path and set config
MONGO_LINK=link for connecting MongoDbmongodb://[username:password@]<host>[:port]/<database>?retryWrites=true&w=majority
MANAGER_USERNAME=username for logging in admin e.g.
admin
MANAGER_PASSWORD=password for logging in admin e.g.admin
MANAGER_SECRET_KEY=secret key for generating JWTBASE_URL=base url, it will be spliced with the image address (
Required "/"
) e.g. http://172.23.107.93:3011/v1/
REDIRECT_URL=redirect after a client is requesting a picture (If this option isundefined
, it will response image immediately.Not required "/"
) e.g.http://127.0.0.1:6543
WHITE_LIST=cors e.g.
["123", "123"]
(If this option isundefined
, it will allow all requests)COMMAND=the command to be executed e.g.
/root/test/upload.sh
(If this option isundefined
, it will rungit add .
git commit -m "chore: update"
git push -f
)
- Create Valaxy under
template
and usegit
to push it to github (Remember to usenpm
andgit
env is required)
This program is using git push -f
to push, so make sure that you have permission to force push and there is no conflict to avoid data loss.
-
Create folder
upload
-
Start the server
pnpm dev
-
Api
v1/image
withPOST
will delay inserting image information into the database, which means that you can't read all image information from the database at the first time, especially uploading too many images at one time. -
If you upload a file with the same file name within a day, the old file will be overwritten