This repository contains the backend code for Wory, a freelancing website. The backend is built using Node.js, Express, and TypeScript, with MongoDB as the database. It includes features for user authentication, project management, and project tagging.
- Features
- Getting Started
- Installation
- Configuration
- Running the Server
- API Endpoints
- Project Structure
- Dependencies
- Contributing
- License
- User signup/login with role-based authentication (Client and Freelancer)
- CRUD operations for projects (only Clients can create, update, and delete projects)
- Fetch projects by tags
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Make sure you have the following installed on your local machine:
- Node.js
- npm (Node Package Manager)
- MongoDB
-
Clone the repository:
git clone https://github.com/your-username/wory-backend.git cd wory-backend
-
Install the dependencies:
npm install
Create a .env
file in the root directory and add the following environment variables:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
Replace your_mongodb_connection_string
with your actual MongoDB connection string and your_secret_key
with a secret key of your choice.
To start the server in development mode, run:
npm start
- Auth Routes
- POST /api/auth/signup - Sign up a new user
- POST /api/auth/login - Log in an existing user
- Project Routes
- POST /api/projects - Create a new project (Client only)
- PUT /api/projects/:projectId - Update a project (Client only)
- DELETE /api/projects/:projectId - Delete a project (Client only)
- GET /api/projects - List all projects
- GET /api/projects/tag/:tag - Fetch projects by tag