Social Media Posts Application
The App is a simple social media application that allows users to post interesting events that happened in their lives. We make use of MongoDb, Express, Reacts, Nodejs (MERN)
A Full CRUD application, we perform on posts of users. This medium post is mainly focused on the server side of the application.
Checkout the application at → Social posts app
Index
- npm modules used
- Database
- Features/operations
- Run the server (nodejs) locally
- Run the frontend (reactjs) locally
- End application
- Platforms used to host the Server and frontend
- Usefull Links
1. npm Module
- body-parser : Enables us to send post requests
- cors : Enables cross origin requests
- express : Framework for routing of our application
- mongoose : To create models
2. Database
We use MongoDB (Cloud Atlas), which is free to host database.
3. Features/operations in the application
Users must be able to,
- Share post details with an image
- Like the posts
- delete posts
- update posts
4. Running the Application Server locally
- Download the Code from Github
- Add a ‘.env’ file with the required environment variables, they are
- DB_CONNECTION_URL ( your unique URL from MongoDB website) - Run the command, in the terminal
>> npm install
(This installs all the dependencies based on package.json file) - Then run the command
>> npm start or node index.js
(This starts the server on port 3000, by default)
Now, the server is ready to receive the requests.
5. Running the Application React Front-end locally
For the front-end of the application we use reactjs
- Download the code from social posts app-Github
- Run the command
>> npx i
(This installs all the required dependencies) - Run the command
>> npm start
(This starts the reatjs app)
Use can now use the application locally from your system.
→ Make sure to run your server first, because frontend does not do much without the server :)
6. End Application
- Enter the post details and you can see that the data is being stored in MongoDb and displayed on the page instantly.
- You can give likes to posts and delete a post as well.
- To update the post, click on the three dots on the post and you can edit the post
Checkout the application at → Social posts app
7. Platforms used to host the website (Obviously free sites ☺️)
- Server is hosted on website “render” → https://render.com/
- Frontend is hosted on website “netlify” → https://www.netlify.com
8. Links
Checkout the live application at → Social posts app
- Frontend (reactjs) Code in Github Repo → social posts app frontend code
- Server (nodejs) Code in Github Repo → social posts app server code
- Hosted Server Link : https://social-posts-application.onrender.com/
Any doubts/questions feel free to ask in comments.