If you have successfully completed the previous sections, your .env file should look like this:
.env
# APP #SITE_NAME=SMUPortalAPP_SECRET=YgTP8SVHvLYWTn4E3aaM9tXPw8x-lInKCfFO10ZQWBoREFRESH_TOKEN=1UKfOmU5rlhan2wnkyjQGkK2sNaJCE-rPS-hOls5WlkTOKEN_EXPIRES_IN=1h# Email domain names should be seperated by a vertical bar (used in regex)EMAIL_DOMAINS=medtech.tn|msb.tn|smu.tn# DB #DB_URL=<DB-CONNECTION-STRING># NodeMailer ## SMTP_USER should contain an email not a usernameSMTP_SERVICE=gmailSMTP_USER=<EMAIL-ADDRESS>SMTP_TYPE=OAuth2# Google OAuthG_CLIENT_ID=<CLIENT-ID>G_CLIENT_SECRET=<CLIENT-SECRET>G_ACCESS_TOKEN=<ACCESS-TOEKN>G_REFRESH_TOKEN=<REFRESH-TOEKN>G_REDIRECT_URI=https://developers.google.com/oauthplayground
Do not forget to replace all placeholders (e.g. <CLIENT-ID>) with their correct values.
We are all set to start the backend code.
First, install the dependencies using npm i command.
~/smuportal-backend (master)npmi
Once that is finished, you can start the server using npm start and you should get the following output
~/smuportal-backend (master)npmstart> smuportal@0.0.0 start ~/smuportal-backend> nodemon server.js[nodemon] 2.0.4[nodemon] to restart at any time, enter `rs`[nodemon] watchingpath(s):*.*[nodemon] watching extensions: js,mjs,json[nodemon] starting `nodeserver.js`ServerisupConnectiontoDBestablished!
If for some reason you got a different output, please make sure that you have correctly followed the instructions from previous sections or you can open an issue.
That's it! The backend server is now running. If you are comfortable enough with backend technologies you can start developing, or you can browse the following sections where we go through a small example of a backend service.