Demo server that demonstrates possibilities of decorators
Base nodejs server project to show power of @decorators
Main dependencies:
GET /status
- server status checkGET /auth/facebook
- main facebook auth endpointget /auth/facebook/authorize
- facebook auth callback endpointget /auth/refresh
- refresh token endpointCopy environment.example
to environment
and add required environment vars
NODE_ENV
- nodejs environmentPORT
- server portMONGO_URI
- mongo database uriFACEBOOK_APP_ID
- facebook application idFACEBOOK_APP_SECRET
- facebook application secretFACEBOOK_APP_CALLBACK
- facebook application callback uriJWT_ISSUER
- jwt issuerJWT_ACCESS_EXPIRATION
- jwt access expiration lifespanJWT_REFRESH_EXPIRATION
- jwt access expiration lifespanyarn
yarn start
http://localhost:{{port}}
yarn up
http://localhost:{{port}}
Postman collection is available in the root folder of the project.
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/.bin/index.js",
"preLaunchTask": "npm: build",
"cwd": "${workspaceFolder}",
"outputCapture": "std",
"env": {
"NODE_ENV": "development",
"PORT": "8080",
"MONGO_URI": "mongodb://localhost:32772/decorators",
"FACEBOOK_APP_ID": "xxxxxxxxxxxxxxx",
"FACEBOOK_APP_SECRET": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"FACEBOOK_APP_CALLBACK": "http://localhost:8080/auth/facebook/authorize",
"JWT_ISSUER": "decorators",
"JWT_ACCESS_EXPIRATION": "1h",
"JWT_REFRESH_EXPIRATION": "30d"
}
},
{
"type": "node",
"request": "attach",
"port": 5858,
"name": "Attach Program",
"preLaunchTask": "npm: build",
"address": "localhost",
"sourceMaps": true,
"localRoot": "${workspaceFolder}",
"remoteRoot": "/usr/src/service"
}
]
}