Git Product home page Git Product logo

api-mytwitter-elixir's Introduction

MyTwitter Api

Using:

  • Elixir v1.10 released
  • Phoenix Framework v1.4.14
  • Ecto v3.1

To start this project:

  • git clone this repository
  • Configure database params in ./config/dev.exs
      # Configure your database
      config :project_name, ProjectName.Repo,
      username: "username",
      password: "password",
      database: "database_name",
      hostname: "host",
      show_sensitive_data_on_connection_error: true,
      pool_size: 10
    
  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.setup
  • Execute this command seeds for insert data demo in database mix run priv\repo\seeds\user_seeds.exs and mix run priv\repo\seeds\tweet_seeds.exs
  • Install Node.js dependencies with cd assets && npm install
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Tests routs and models

  • Using Postman or Insomnia
  • Methods and Routes
Method Route
GET http://localhost:4000/api/users
GET http://localhost:4000/api/users/:id
POST http://localhost:4000/api/users
GET http://localhost:4000/api/tweets
GET http://localhost:4000/api/tweets/:id
POST http://localhost:4000/api/tweets
GET http://localhost:4000/api/tweets/user/:user_id
  • Models
    {"user":
      {
        "name": "name",
        "nickname": "nickname",
        "email": "[email protected]",
        "password": "1234"
      }
    }
    
    {"tweet": 
      {
        "user_id": 20, 
        "text": "First tweet test",
        "likes": 12,
        "created_at": "2020-02-22 19:54:41"
      }
    }
    
    

Ready to run in production? Please check our deployment guides.

Learn more

api-mytwitter-elixir's People

Contributors

antonio-abrantes avatar

Watchers

 avatar  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.