Blog 11-22-21
1 Comment module (Twikoo)
1.1 MongoDB
1.1.1 Create an account
Create a MongoDB account and choose Shared Cluster (Free)
The recommended region is AWS / N. Virginia (us-east-1)
1.1.2 Database Deployment
-
Add a connection IP address: Allow access from anywhere ➡️ click Add IP Address
-
Create a Database User with a
username
andpassword
. Keep it safe somewhere.
After that, go to next step. ❤️
Choose Connect your application
Copy the code in Add your connection string into your application code, starting with mongodb+srv://
Replace password
with the password for username
. Replace myFirstDatabase
with the name of the database that connections will use by default.
1.2 Vercel
-
Register an account at Vercel
-
Click the link below to deploy Twikoo to Vercel with one click:
➡️ Deploy
Create Git Repository: enter a Repository Name
Enter Settings-Environment Variables, add the environment variable MONGODB_URI
, the value is the database connection string (see above)
Press Redeploy.
Navigate to Overview and click on the link under Domains. If the environment is configured correctly, you can see the prompt “Twikoo cloud function is operating normally” (“云函数运行正常”)
Vercel Domains (including the https:// prefix, such as https://xxx.vercel.app) is your environment id for Twikoo
In case of error like URI does not have hostname, domain name and tld
Go to the database, click edit password and generate a new password, give only characters and numbers.