This repository contains code for a server-side application built with Node.js and Express.js. The code sets up a server that handles various routes related to user authentication, user management, and URL management. The code includes functionality to get URLs, shorten and set URLs, update URLs, and delete URLs.
-- Installation
-- Usage
-- Configuration
-- API Endpoints
-- Contributing
-- License
- Clone the repository to your local machine:
git clone <repository_url>- Install the required dependencies by running the following command in the project directory:
npm install- Set up the necessary configuration by creating a .env file in the root directory of the project and providing the required environment variables.
#Usage
- Start the server by running the following command:
node server.js- The server will start running on the specified port (default: 3000).
- The server exposes various API endpoints for user authentication, user management, and URL management.
--Create a .env file in the root directory of the project and provide the following environment variables:
-- PORT: The port on which the server will run.
The server provides the following API endpoints:
Description: Retrieve URLs associated with a user.
-- Route: GET /api/urls
-- Access: Private
-- Request Query Parameters:
-- user (required): User ID or email
-- Response: JSON array of URLs
Description: Shorten a URL and associate it with a key for encryption.
-- Route: POST /api/urls/:key
-- Access: Private
-- Request Body Parameters:
url (required): Original URL
user (required): User ID or email
key (required): Key for encryption
--Response: JSON object of the created URL
Description: Update an existing URL.
-- Route: PUT /api/goals
-- Access: Private
-- Request Parameters:
id (required): URL ID
--Request Body: Updated URL data
-- Response: JSON object of the updated URL v
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
1)Fork the repository
2) Create a new branch
3) Make your changes
4) Test your changes
5) Submit a pull request