A simple chat application using express.js to develop APIs
Tech | Usage |
---|---|
Express.js |
Web application framework to handle HTTP request and responses |
jwt |
To generate authentication token |
bcrypt |
To incrypt text e.g. my_password to something ashvkbasdkhvbsdjvsdnljvnhsbv |
dotenv |
For environment variables |
MongoDB |
A NoSQL database to store data |
socket.io |
For real time communication between client(Our mobile app) and server |
run npm install
, this command will install all the necessary packages required for this project.
create two file called .env.dev and .env.prod at the root of this project directory and add environment variables which are listed below,
Variable Name | Usage |
---|---|
PORT | Port number on which we want our application to run |
MONGO_URI | Your MongoDB database url |
JWT_SECRET | Secret key to pass in JWT |
Your .env.dev file should look like this:
PORT=8080
MONGO_URI={`URL TO MONGODB DATABASE`}
JWT_SECRET=THISISMYSECRET
same goes for the .env.prod file
For Development: npm run dev
For Production: npm start