- Package dependencies
- ENV
- Server
- Unit Testing
- Gulp
- Vps
- Workflow
- Deployment
- Endpoints
- contributors
- Airbnb style guide
Install all dependencies.
npm install
npm install -g mocha gulp
create a env.json on root level for database connection
{
"DB_NAME": "dbname",
"DB_USER": "dbuser",
"DB_PASS": "dbpass",
"DB_HOST": "localhost",
"DB_SCHEMA": "mysql",
"DB_PORT": "3306"
}
start the server
node src/server
To run unit test.
*sever must be off
mocha
or
npm test
gulp is used to automate a github commit so first it adds all file changes followed by a commit message then a push to origin master. to use this automated feature in terminal use
gulp
This project uses gulp for automated package.json version bump
// bump up major
gulp bump --major
// bump up minor
gulp bump --minor
// bump up minor
gulp bump --patch
API on virtual private server youtube
1 Create a new feature branch
git checkout -b branchname
2 Push up to new feature branch
git add -A
git commit -m 'insert your msg here'
git push
if this is your first time pushing to a new remote branch run
git push --set-upstream origin branchname
3 Once commited we return to the master branch to merge (pull in) the feature branch
git checkout master
4 Now in the master branch merge your feature branch into your master branch using the merge command followed by a push
git merge branchname
git push
5 Now that we have successfully merged our feature branch our ci tool(codeship) will check to make sure our codebase is passing.
6 Once codeship confirms that the build passes we want to tag this version then merge our master into our release branch.
7 Create a tag run
git tag v1.0.6 commitidgoeshere
8 Once we have created our tag we want to continue with our merge to the release branch
git checkout release
git merge master
git push
9 Once we push to release branch our codebase enters the first phase of the Deployment pipeline
-
First we merge our codebase to master our ci test runs to confirm our codebase is passing our automated unit test.
-
If our codebase passes ci test (codeship) we manually merge master branch to the release branch which is the first step in the deployment pipeline.
-
When ci tool (codeship) confirms the build is good it will automatically be deployed from release repo onto our staging server.
-
once completed and we confirmed out codebase is good we will manually push from staging server to production server.
- create an url
- read all url
- read url by id
- redirect based upon the short URL provided
- update url
- delete url
{
"hello": "world"
}
{
"healty": true
}
- when creating new urls include http://
{
"url": "http://www.facebook.com/"
}
{}
[
{
"id": 1,
"url": "www.facebook.com",
"shortURL": "8q6rdltjrl",
"updatedAt": "2016-10-04T22:07:39.000Z",
"createdAt": "2016-10-04T22:07:39.000Z"
},
{
"id": 2,
"url": "http://www.testurl1.com",
"shortURL": "66vo7fl7aq8",
"createdAt": "2016-10-02T22:19:27.000Z",
"updatedAt": "2016-10-02T22:19:27.000Z",
"userID": null
},
{
"id": 3,
"url": "http://www.exampleurl2.com",
"shortURL": "66vo7fliar8",
"createdAt": "2016-10-02T22:19:27.000Z",
"updatedAt": "2016-10-02T22:19:27.000Z",
"userID": null
}
]
{
"id": 1,
"url": "http://www.exampleurl.com",
"shortURL": "66vo7fl7ar8",
"createdAt": "2016-10-02T22:19:27.000Z",
"updatedAt": "2016-10-02T22:19:27.000Z",
"userID": null
}
"url": "http://www.example.com",
"shortURL": "66vo7fl7ar8"
1
{
"name": "bart",
"username": "simpsonsfan",
"password": "testpass"
}
[
{
"id": 1,
"name": "david",
"username": "david12",
"password": "reojgoifdklm",
"createdAt": "2016-10-08T01:45:31.000Z",
"updatedAt": "2016-10-08T01:45:31.000Z",
"urls": []
},
{
"id": 2,
"name": "peter",
"username": "peterpanman",
"password": "reojgoifdklm",
"createdAt": "2016-10-08T01:45:31.000Z",
"updatedAt": "2016-10-08T01:45:31.000Z",
"urls": []
},
{
"id": 3,
"name": "dan",
"username": "dantheman",
"password": "reojgoifdklm",
"createdAt": "2016-10-08T01:45:31.000Z",
"updatedAt": "2016-10-08T01:45:31.000Z",
"urls": []
}
]
{
"id": 3,
"name": "dan",
"username": "dantheman",
"password": "reojgoifdklm",
"tokenreq": "true",
"createdAt": "2016-10-08T01:45:31.000Z",
"updatedAt": "2016-10-08T01:45:31.000Z",
"urls": []
}
{
"name": "bart",
"username": "simpsonsfan"
}
1