Giter Site home page Giter Site logo

events-api's Introduction

Events API 🤵

An API to register upcoming events. Powered by TypeScript and Express

Getting Started

Prerequisites

Installation

  1. Clone the GitHub repository in the desired folder. You can do it by copying the https link, the ssh link or downloading the zip file:
  • cloning with https link:
git clone https://github.com/kellysondias/events-api
  • cloning with ssh link:
git@github.com:kellysondias/events-api.git
  1. After the project has been downloaded, you can navigate to the project's directory and install the dependencies with a package manager of your preference:
  • Navigate to the project's directory:
cd path\of\your\cloned\folder
  • Yarn command:

    yarn install
    
  • npm command:

    npm install
    

Configuration

  1. Create a .env file in the root directory (in the same level as package.json). You can find a more practical example in the .env.example file.

  1. Set the variables as below replacing the <> fields with your information:
  • MONGO_URI: "This is where your MongoDB Atlas URI will be set to create a database connection"

  • PORT: "This is where you'll choose in which port your local host server will run"

    • Note: if PORT is not defined, it is set to 3000 automatically
  • JWT_SECRET: "This is where you'll store your JWT secret string for creating user's validation"

    • You can run the openssl rand -base64 32 command to generate a secret string

Example:

MONGO_URI='<your_db_URI>'
PORT=<choose_a_port>
JWT_SECRET=<your_secret>

Running the Server

After all this configuration is set and ready to go:

  1. Run the app with the dev script.
  • Yarn command:

    yarn dev
    
  • npm command:

    npm run dev
    

And now the API should be officially running :] .

Endpoints

Note: <URL> equals localhost:<your_port>/api/v1

Users:

<URL>/users/sign-up

  • HTTP Method
    • POST (Signs-up a new user)
      • Required fields:
        {
            "firstName": "Lorem",
            "lastName": "Doe",
            "birthDate": "2023-12-28",
            "city": "string",
            "country": "string",
            "email": "[email protected]",
            "password": "Password1",
            "confirmPassword": "Password1"
        }
        

<URL>/users/sign-in

  • HTTP Methods
    • POST (Signs-in an user generating a web token)

Events:

Note: Every event route is only accessible through user's sign-in authentication

<URL>/events

  • HTTP Methods

    • POST (Creates a new event)

      • Required fields:
        {
            "description": "string",
            "dayOfWeek": "monday"
        }
        
    • GET (Gets all events or specific events based on the day of the week they were created)

      • Request parameter (optional):
        dayOfWeek=<day_of_week>
        
    • DELETE (Delete specific events based on the day of the week they were created)

      • Request parameter (required):
        dayOfWeek=<day_of_week>
        

<URL>/events:id

  • HTTP Methods

    • GET (Gets all events based on the user's id)

    • DELETE (Deletes all events based on the user's id)

Acknowledgments:

Developed by:

Special thanks:

events-api's People

Contributors

kellysondias avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.