ajthinking / stackoverflow-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

License:MIT License


Languages

Language:JavaScript 98.9%Language:TypeScript 1.1%