This project can be run with docker by doing the following sequence of commands in the root of the project:
docker-compose build && docker-compose upBy default, the client is available at localhost:3000 while the server is listening to localhost:3001.
To run locally, open two terminals and move to the client folder in one of them and to the server folder in the other. Run the command npm install && npm start in each of the terminals.
By default, the client is available at localhost:3000 while the server is listening to localhost:3001.
The client was written in React.js using boostrap, a CSS framework. It includes two pages:
-
/Main page of the project which includes a form to make posts with a given title and text, and a list of submitted posts. Each post in the list contains the display name of the author and their profile picture. -
/profileThis page allows the user to change their display name and profile picture.
Pages are located in client/pages and components in client/components.
The server was written in Node.js and uses a small JSON database provided by lowdb to keep information on the posts, current display name and profile picture of the user. It includes the following routes:
-
GET /postsReturns a JSON object containing the submitted posts. -
POST /postsCreates a new post. -
GET /profileReturns a JSON object containing the user's name and path to profile picture. -
POST /profileModifies the current profile. -
GET /profile/usernameRetrieves the user's name.
Controllers are located in server/controllers. The server/public folder contains the user's profile picture.