Prerequisites Node.js (>= 14.x.x) npm (>= 6.x.x) PostgreSQL
Step-by-Step Instructions
-
Clone Respository git clone https://github.com/rebeccawaweru/Journal_App.git cd JournalApp/server
-
Install dependencies npm install
-
Configure Environment Variables Create a .env file in the root of the server directory. Add the following environment variables: DB_NAME=your_database_name DB_USERNAME=your_database_username DB_PASSWORD=your_database_password DB_HOST=your_database_host_name PORT=your_database_port_number JWT_SECRET=your_jwt_secret_key
-
Run Database Migrations npx sequelize-cli db:migrate
-
Start the Backend Server npm start
-
Verify Server is Running On your console, you should observe the following result:
Server is running on port 5000
Prerequisites Node.js (>= 14.x.x) npm (>= 6.x.x) Expo CLI (install using npm install -g expo-cli) Android Studio or Xcode (for emulators) or a physical device with Expo Go App
Step-by-Step Instructions
-
Clone Respository git clone https://github.com/rebeccawaweru/Journal_App.git cd JournalApp/mobile
-
Install dependencies npm install
-
Start the Expo Development Server npm start
-
Run the App For Android: Press a in the terminal to open the Android emulator. For iOS: Press i in the terminal to open the iOS simulator. Alternatively, scan the QR code in the Expo Go app on your physical device.
-
User Registration URL: /auth/register Method: POST Body Parameters: { "username": "string", "password": "string" } Responses:
201 Created
{ "success": true, "user": { "id": "integer", "username": "string" "password": "string" } }400 Bad Request
: { "error": "string" } -
User Login URL: /auth/login Method: POST Body Parameters: { "username": "string", "password": "string" } Responses:
200 OK
{ "token": "string" }401 Unauthorized
{ "error": "Invalid Credentials" }400 Bad Request
: { "error": "string" } -
Create Journal Entry URL: /journals Method: POST Headers: Authorization: Bearer Body Parameters: { "title": "string", "category": "string" "content": "string", "date": Date } Responses:
201 Created
{ "success": true, "journal": { "id": "integer", "title": "string", "category": "string" "content": "string", "date": Date, "userId":"integer" } }400 Bad Request
: { "error": "string" } -
Get User Journal Entries URL: /journals Method: GET Headers: Authorization: Bearer Responses:
200 OK
{ "journals": [{ "id": "integer", "title": "string", "category": "string" "content": "string", "date": Date, "userId":"integer" }] }400 Bad Request
: { "error": "string" } -
Update Journal Entry URL: /journals/:id Method: PUT Headers: Authorization: Bearer URL Parameters: id - ID of the journal entry Body Parameters: { "title": "string", "category": "string" "content": "string", "date": Date } Responses:
200 OK
{ "success": true, }404 Not Found
: { "error": "Journal entry not found" }400 Bad Request
: { "error": "string" } -
Delete Journal Entry URL: /journals/:id Method: DELETE Headers: Authorization: Bearer URL Parameters: id - ID of the journal entry Responses:
200 OK
{ "success": true, "message":"Journal entry deleted" }404 Not Found
: { "error": "Journal entry not found" }400 Bad Request
: { "error": "string" }