-
node v18.3.0
-
.env
file with the following entries:-
DISCORD_OAUTH_CLIENT_ID
- the applications client id
-
DISCORD_OAUTH_SECRET
- the applications client secret
-
DISCORD_CALLBACK_URL
- the callback url specified in your oauth2 url
-
DISCORD_TOKEN
- your discord bots token
-
PORT
- the port on which the server will listen
-
SESSION_SECRET
- the session secret used to sign the session cookie
-
MONGO_URL
- a connection string to the mongodb database
- if authentication is needed, make sure the connection string has the right format, e.g.
mongodb://myusername:[email protected]:27017/glue_discord?authSource=admin
- the
authSource
parameter is necessary to authenticate against theadmin
database - make sure you avoid special characters in the password as it leads to annoying complications
- the
-
BACKEND_CANISTER_ID
- the canister id of the
glue
backend canister, use the local canister id when developing and a canister from the mainnet when deploying to production
- the canister id of the
-
HOST
- in a node environment we have to specify a host for the agent to work, use the hostname of your local deployment ofthe glue frontend for development and
https://ic0.app
for production
- in a node environment we have to specify a host for the agent to work, use the hostname of your local deployment ofthe glue frontend for development and
-
NODE_ENV
development
for development andproduction
for production
-
- run
yarn install
to install all dependencies - make sure the local deployment of glue is running
- run
yarn start:dev
to run a developmentnodemon
server (make sure your node version is correct, runnvm use
if in doubt)
- run
yarn build
to build the express server - you can then use something like pm2 to deploy the server to production
- to make the express server listen to incoming request to your server, expose it using a
nginx
reverse proxy⚠️ when using nginx reverse proxy: make sure you set the correct proxy headers fornginx
and trust proxy setting forexpress
like here!