-
Notifications
You must be signed in to change notification settings - Fork 1
Server Info
jeffvan576 edited this page Sep 8, 2014
·
7 revisions
Social-Sync-Server Gist
Also can be found in the /backend/server.js file
To Install:
npm install (installs all npm modules in root directory)
To Start Server:
node server
Access Server:
127.0.0.1:3000
API Endpoints:
/twit/
- this is the endpoint that will return the logged in users timeline in JSON format
- visit this first and you will see a 401 unauthorized error
- once you visit /auth/twitter, then revisit /twit and you will see the users timeline
- NOTE: As of right now my token and secret are being stored in the server.js file. This is not working as intended. We will need to be able to pass in the token and secret that are currently stored in localstorage into the /twit endpoint in order for this to work properly (detailed below)
/auth/twitter
- this will log the user in
- use username: jeff_vandalsum, password: jeffvan1
- once logged in you will be redirected to /auth/twitter/callback and the user's token and secret will be on the screen => these are what will need to be stored into a database or localstorage
- these two items will also need to be passed BACK into the get request to /twit which will allow twitter to ensure the user has proper access through the oauth request.
-- I propose we pass them in as follows: 127.0.0.1:3000/twit?t=&s=
-- t and s will be pulled out of the user's local storage
*** NOTE: We can open up any number of endpoints on the twitter api besides the user_timeline (Twitter API points dev.twitter.com), but for now that holds all messages and is a good test to get data up on the MVP.
Twitter Authorization Process: Twitter Auth
(Don't forget to install cors and body-parser using npm. Client side stuff in bower is also critical: angular and angular-ui-router)
- Spin up the simpleserver on python for PORT 8000. Make sure to do this in the social sync directory.
- Go to socialsync/client on localhost:8000. This should show you two clickable logos.
- The Twitter button links to the getNotifications in notifications.js line 22. Data is hardcoded in so change it when you get a new token and secret. You'll have to use the server to get this for now.
- Open a new cmd line. Spin up node server by calling 'node server.js' inside socialsync/backend. This should create a server on localhost:3000.
- Backend Server = localhost:3000. Client = localhost:8000
- Go through localhost:3000/auth/twitter to get the token and secret.
- Hard code it into notifications.js.
- You probably want to save notifications js and restart simple server.
- Now you should be able to click on the twitter button to get the data array from the server.