Skip to content

dogukankotan/express-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-example

API Documentation

Request URL: "http://localhost:3000/"

curl -X POST \
  http://localhost:3000/ \
  -H 'Content-Type: application/json' \
  -d '{
	"startDate": "2016-01-26",
	"endDate": "2018-02-02",
	"minCount": 2700,
	"maxCount": 3000
}'
  • Request Example
{
	"startDate": "2016-01-26",
	"endDate": "2018-02-02",
	"minCount": 2700,
	"maxCount": 3000
}
  • Success Response Example
{
  "code": 200,
  "msg": "Success",
  "records": [
    {
      "_id": "58adc585dedcff7e190af076",
      "key": "NMBUu74JC1bEGECM",
      "createdAt": "2016-07-06T13:12:01.175Z",
      "totalCount": 2800
    },
    {
      "_id": "58adc585dedcff7e190afbe3",
      "key": "ut383XMVB1FtNWNP",
      "createdAt": "2016-07-07T02:25:28.485Z",
      "totalCount": 2900
    },
    {
      "_id": "58adc57a1f84e37c19df0a61",
      "key": "840hRiaWF4C1xupD",
      "createdAt": "2016-07-07T06:34:29.059Z",
      "totalCount": 2800
    },
    ...
  ],
  "errors": []

App

Database Model

// Model
{
    "_id": "58adc585dedcff7e190af076",
    "key": "NMBUu74JC1bEGECM",
    "createdAt": "2016-07-06T13:12:01.175Z",
    "value": "QYV8Jr6Kn52OrnL35HWTcWNkl2FcPH3Hc0Q5AtnW5D1UCjrIFSZNcfMWCSsIW7NqdukbL6oshFlBmhgb8wbvqN39qTKCckJ499LzaRYgY87Qszv00DdVJghXGvWYbFiaR5cRQqHsAnkX",
    "counts": [ 0, 600, 500 ]
  },

Requirements

  • node
  • npm

Build

npm install

How to run

  • Rename .env.example file to .env

  • Change DATABASE_URL in .env file with your mongoDB url.

npm start

How to test

npm test

Test only code style

npx standard --fix

Test only code

npx jest

Fix code style issues

npx standard --fix

References

About

Learning express

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •