/stackoverflow-server

Primary LanguageJavaScriptMIT LicenseMIT

Stackoverflow: server 💫

Simplified clone of Stackoverflow. This repo holds the Server. See client here.

🚀 Tech Stack

  • NodeJs
  • TypeScript
  • Express
  • MongoDB
  • Mongoose

⚠️ Prerequisite

  • node
  • npm/yarn
  • mongodb

💿 How to run local

# Clone this repository
$ git clone git@github.com:ajthinking/stackoverflow-server.git

# Go into the repository
$ cd stackoverflow-server

# Start mongodb locally
$ mongod

# Install dependencies
$ yarn install

# Start the backend server
$ yarn dev

# Your API should now be running, try:
$ open http://localhost:3000/api/question

🔎 Testing

Make sure mongodb is running before testing the server.

$ yarn test

There are missing tests.

🌐 Deploy

Deploying Server App on Heroku

  • You will need to have setup a MongoDB Atlas account and database.

  • Make sure that the cluster has allowlisted connections from anywhere.

  • Create a Heroku new app.

  • Go to app settings

  • Add the following enviroments.

    • DATABASE_URL (to use your MongoDB connection string)
    • JWT_SECRET
  • Add Nodejs to buildpacks

  •   # Go into the repository
      $ cd stackoverflow-server
    
      # Heroku Setup
      $ yarn install -g heroku
      $ heroku login
      $ heroku git:remote -a your-app-name
    
      # push subdirectory repository with subtree
      $ git subtree push --prefix server heroku master
    

👑 Acknowledgments

This is a continuation of salihozdemir/stackoverflow-clone

📝 License

This project is made available under the MIT License.