ttbarnes / mean-tweets

Mini Twitter with MEAN

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mean tweets - Mini Twitter with MEAN

NOTE: This is old and no longer maintained.

I built this app in order to learn more about Node, Express and MongoDB. I hope it helps others do the same :-)

Prerequisites

Quick start

  1. Install the dependencies: npm install

  2. Start the server: grunt (port 2000)

If you have your own mongo db, update the url in server.js or use dotenv.

Tech

  • MEAN stack: MongoDB, Express, Angular, Node.js
  • Angular services/modules
    • ui-router
    • restangular
    • angular-moment
    • angular-elastic
    • ui-router-title
    • ngDialog
    • auth0
  • mongoDB, mongoose
  • grunt
  • karma, jasmine (front end tests)
  • mocha, should.js (api tests)
  • lodash
  • fontawesome

Grunt tasks

  • start server: grunt (runs tests, watches for changes).

  • run front end tests: grunt test

  • run api tests: grunt test:api

Test credentials

password is the obvious.

Notes

  • Currently for v1, authentication is done with auth0. It would be great to use Passport instead.

  • Currently no e2e tests, only unit tests.

API

tweets

  • post a single tweet

    • POST /api/tweets
  • get all tweets by username

  • get a single tweet by tweet_id

    • GET /api/tweets/:tweet_id
  • update a tweet by tweet_id

    • PUT /api/tweets/:tweet_id
  • delete a tweet by tweet_id

    • DELETE /api/tweets/:tweet_id
  • add a username to a tweet's favourites array

    • PUT /api/tweets/:tweet_id/favourites
  • delete a favourite from a tweet

  • add a username to a tweet's retweets array

    • PUT /api/tweets/:tweet_id/retweets
  • delete a retweet from a tweet

    • DELETE /api/tweets/:tweet_id/retweets/:retweet_id

timeline

search

profiles

  • get a single user

  • add a single new username

    • POST /api/profiles/:username
    • eg: { username: String }
  • add public profile details

    • POST /api/profiles/:username/:details
  • add a new following username to a user's profile

    • PUT /api/profiles/:username/following
  • add a new follower username to a user's profile

    • PUT /api/profiles/:username/followers
  • add a username to a user's favourites array

    • PUT /api/profiles/:username/tweets/favourites/:tweet_id
  • delete a username from a user's favourites array

    • DELETE /api/profiles/:username/tweets/favourites/:tweet_id
  • add a username to a user's retweets array

    • PUT /api/profiles/:username/tweets/retweets/:tweet_id

routes for api tests

  • get all tweets

    • GET /api/test/tweets/all
  • delete all tweets

    • DELETE /api/test/tweets/all
  • delete all profiles

    • DELETE /api/test/profiles/all

Contributions

Always welcome, please submit a PR :-)

About

Mini Twitter with MEAN


Languages

Language:JavaScript 76.0%Language:CSS 13.5%Language:HTML 10.4%Language:Ruby 0.1%