Starting the Backend

If you have successfully completed the previous sections, your .env file should look like this:

.env
# APP #
SITE_NAME = SMUPortal
APP_SECRET = YgTP8SVHvLYWTn4E3aaM9tXPw8x-lInKCfFO10ZQWBo
REFRESH_TOKEN = 1UKfOmU5rlhan2wnkyjQGkK2sNaJCE-rPS-hOls5Wlk
TOKEN_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 username
SMTP_SERVICE = gmail
SMTP_USER = <EMAIL-ADDRESS>
SMTP_TYPE = OAuth2

# Google OAuth
G_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
circle-exclamation

We are all set to start the backend code.

First, install the dependencies using npm i command.

Once that is finished, you can start the server using npm start and you should get the following output

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 issuearrow-up-right.

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.

Happy coding 🎉!

Last updated

Was this helpful?