Skip to content

Developed a social media web application using React where users will be able to create profiles and find and follow others who they may be interested in. Users will be able to make posts which will be displayed on the feeds of anyone who is currently following them as well as see posts from whoever they are currently following.

Notifications You must be signed in to change notification settings

sadman787/TypeSetter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typesetter

Developing with Docker locally

Install Docker 18.06+ and latest docker-compose. Then you can bring up the stack with:

docker-compose pull
docker-compose build
docker-compose run {app,api} npm install
docker-compose up -d
docker-compose logs -f

The api and app folders are volume mounted from your host into the container, so you can simply edit files on the host and nodemon or webpack inside the container see the changes. To install new packages:

docker-compose run api npm install --save express

You can access mongo express at localhost:8081.

API Authentication

The API uses JWT based authentication. After creating an account, login with:

curl -s -X POST -H "Content-Type: application/json" localhost:3000/auth/login -d '{"email":"bob@mail.com", "password":"password"}'

If successful, should get 200 and a response like { data: { token } }. Capture this into a variable using jq -r '.data.token':

TOKEN=$(curl -s -X POST -H "Content-Type: application/json" localhost:3000/auth/login -d '{"email":"bob@mail.com", "password":"password"}' | jq -r '.data.token')

You can inspect this token (the header, payload, signature) using jwt.io.

Then make an authenticated request:

curl -s -H "Authorization: Bearer $TOKEN" localhost:3000/auth/protectedtest

Which will either succeed or respond with appropiate error, like 403 jwt expired.

TODOs

  • JWT renewal with each successful request (means client can wait timeout after last succesful request before expiring)
  • Incorporate into frontend (essentially, use session storage instead of environment variable from curl example)

About

Developed a social media web application using React where users will be able to create profiles and find and follow others who they may be interested in. Users will be able to make posts which will be displayed on the feeds of anyone who is currently following them as well as see posts from whoever they are currently following.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published