Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ineff3/twitter-backend
Node.js + Express, twitter-clone backend part.
https://github.com/ineff3/twitter-backend
express mongodb mongoose nodejs
Last synced: 12 days ago
JSON representation
Node.js + Express, twitter-clone backend part.
- Host: GitHub
- URL: https://github.com/ineff3/twitter-backend
- Owner: ineff3
- Created: 2024-03-08T18:38:31.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-05-17T09:04:00.000Z (8 months ago)
- Last Synced: 2024-05-18T08:50:05.701Z (8 months ago)
- Topics: express, mongodb, mongoose, nodejs
- Language: JavaScript
- Homepage:
- Size: 3.69 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Twitter Clone Backend
This is the backend part of the Twitter clone project built with Node.js, Express, and MongoDB.
## Getting Started
### Prerequisites
- Node.js
- MongoDB Atlas account### Installation
1. Clone the repository:
```sh
git clone https://github.com/ineff3/twitter-backend.git
cd twitter-backend
```2. Install dependencies:
```
npm install
```3. Set up environment variables:
- Copy the `.env.example` file to `.env`:
```
cp .env.example .env
```
- Fill in your MongoDB connection string and other secrets in the `.env` file:```dotenv
DB_CONNECTION_STRING='mongodb+srv://:@/?retryWrites=true&w=majority'
ACCESS_TOKEN_SECRET='your_access_token_secret'
REFRESH_TOKEN_SECRET='your_refresh_token_secret'
PORT='3000'
CORS_ORIGIN='http://localhost:5173'
```DB_CONNECTION_STRING: Your MongoDB connection string.
ACCESS_TOKEN_SECRET: Secret key for generating access tokens.
REFRESH_TOKEN_SECRET: Secret key for generating refresh tokens.
PORT: Port number for the server (default is 3000).
CORS_ORIGIN: The origin URL for CORS (your frontend parat URL).4. Start the server:
```
node server
```## Environment Variables
Make sure to set up the following environment variables in your `.env` file:
- `DB_CONNECTION_STRING`: Your MongoDB connection string.
- `ACCESS_TOKEN_SECRET`: Secret key for generating access tokens.
- `REFRESH_TOKEN_SECRET`: Secret key for generating refresh tokens.
- `PORT`: Port number for the server (default is 3000).
- `CORS_ORIGIN`: The origin URL for CORS (your frontend's URL).