Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kirti136/gurucool_assignment
https://github.com/kirti136/gurucool_assignment
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kirti136/gurucool_assignment
- Owner: kirti136
- Created: 2024-08-07T16:07:03.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-22T10:34:06.000Z (5 months ago)
- Last Synced: 2024-08-22T12:05:32.873Z (5 months ago)
- Language: JavaScript
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gurucool Assignment Backend
This is the backend API for the Gurucool Assignment. It provides routes for user authentication, authorization, and url management. The project uses Node.js, Express, Mongoose, JWT, and Swagger for API documentation.
## Demo Video and Postman Data
- [Demo Video](https://drive.google.com/file/d/1FAjAHg-5jknCjzh99Pk_aF_kO6SuaV11/view?usp=drive_link)
- [Deployed Link](https://gurucool-assignment-yf1e.onrender.com/)## Run Locally
Clone the project
```bash
git clone https://github.com/kirti136/gurucool_assignment
```Install dependencies
```bash
npm install
```Start the server
```bash
npm run start or npm start
```## Environment Variables
To run this project, you will need to add the following environment variables to your .env file
`PORT`
`MONGO_URL`
`JWT_SECRET_KEY`## API Reference
### SWAGGER_DOCS
#### Serve swagger docs
```http
https://gurucool-assignment-yf1e.onrender.com/api-docs
```### USER
#### Register a new user
```http
POST /api/user/register
```#### Log in a user
```http
POST /api/user/login
```#### Log out a user
```http
POST /api/user/logout
```#### Get all users (Admin)
```http
GET /api/user/
```### URL
#### Generate Short Url
```http
POST /api/url/shorten
```#### Redirector
```http
GET /api/url/:shortUrl
```## Tech Stack
- **Node.js**: JavaScript runtime for server-side programming.
- **Express**: Fast, unopinionated, minimalist web framework for Node.js.
- **Mongoose**: Elegant MongoDB object modeling for Node.js.
- **JWT**: JSON Web Token for secure user authentication.
- **Swagger**: Simplifies API development by documenting API endpoints.
- **express-validator**: Middleware for validating and sanitizing user input.
- **dotenv**: Loads environment variables from a `.env` file.
- **cookie-parser**: Parse HTTP request cookies.
- **cors**: Provides a Connect/Express middleware to enable CORS.
- **bcryptjs**: Library to hash passwords.