Skip to content

sparcs-kaist/zabo-server-nodejs

Repository files navigation




Logo

ZABO with modern JS, designed and developed by SPARCS
Go to ZABO

About

ZABO helps KAIST students based individuals or clubs advertising themselves via web based platform not only in an analogue way. While this service is open public, only KAIST members are allowed to post images on this website and others must manually get permission from SPARCS KAIST's current project manager.

We're expecting anyone satisfying above conditions posting there recruiting announcements, performance schedules, and any other events in much better condition (posting paper posters at each dorms, cafeterias, E11, ...etc) with ease and joy.

Please contact SPARCS KAIST to get more detailed information.

If you're looking for frontend codes, you can find it in here

API Specification

Document for API Speicifcation can be found here

Table of Contents

Prerequisites

You’ll need to have Node 8.10.0 or later on your local development and production machine. You can use nvm (macOS/Linux) or nvm-windows to easily switch Node versions between different projects.

node -v // v10.16.3

Redis

We expect REDIS server to be running on it's default port(6379).

MongoDB

We expect MongoDB server to be running on it's default port(27017). We expect to use zabo-{env} for each environment as database name.

Environment Secrets

List of environment variables required are specified in here

You can find proper values for those here

In order to get a new SSO client id and secrets, refer SPARCS SSO Dev Center

!important: Please be extra careful not to upload any kind of secrets on github.

Getting Started

Running Development Server

You need Mongodb and Redis running on your local machine before running our server.
Please check *prerequisites*(#prerequisites) to find out more

npm

Run development server

npm install // Installing dependencied with node js package manager
npm run dev // Run development server with nodemon watching ./src folder

yarn

Run server

yarn // Installing dependencied with node js package manager
yarn dev // Run development server with nodemon watching ./src folder

Running Production Server

npm

Run server

npm install // Installing dependencied with node js package manager
npm start // Run production server with NODE_ENV=production

yarn

Run server

yarn // Installing dependencied with node js package manager
yarn start // Run production server with NODE_ENV=production

Folder Structure

zabo-server
├── README.md
├── LICENSE.md
├── node_modules
├── package.json
├── .gitignore
├── config
│   ├── .env.example
│   ├── .env.development
│   ├── .env.staging
│   ├── .env.production
│   └── env.js
├── src
│   ├── bin
│   ├── db
│   ├── routes
│   ├── utils
│   ├── controllers
│   └── app.js
└── index.js  - Entry point

Deployment

All api endpoints are prefixed with /api.
Therefore, you can easily classify API requests out of page loading requests (toward zabo-front-reactjs).
Example nginx configuration is located here

Currently running on

SSAL as development server
Netlify for continuos integration test and PWA development
To be deployed on https://zabo.sparcs.org/ and https://zabo.kaist.ac.kr

Built With

  • Express.js - Used to build server.
  • SPARCS SSO - Using SPARCS SSO for sign-on
  • JWT - JWT for authentication
  • AWS S3 - Amazon S3(Simple Storage Service) is an object storage service that offers nice scalability, data availability, security, and performance.
  • MongoDB - Widely used free to use NoSQL database.
  • Redis - In-memory data structure store.
  • Docker - Containerizate software. Docker configuration should be uploaded soon

S3

All the posters are stored in AWS S3

Commit Message Guidelines

I referred Google's Angular JS's contributor's commit message guidelines to format commit messages. This leads to more unified and readable messages helping further history lookups and even CI integrations.

By the way, this repository's commit messages format is not exactly same as the one suggested above.

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

The header is mandatory and the scope of the header is optional.

Any line of the commit message cannot be longer 100 characters! This allows the message to be easier to read on GitHub as well as in various git tools.

Samples: (even more samples)

docs(README): update README adding instruction on how to start docker on EC2
build(babel): Add babel preset-env

Add @babel/core, @babel/preset-env and register with @babel/register.
Entry point of the application is set to be bin/www_es6.js
Refer to the package.json file to fidn out more.

Revert

If the commit reverts a previous commit, it should begin with revert:, followed by the header of the reverted commit. In the body it should say: This reverts commit <hash>., where the hash is the SHA of the commit being reverted.

Type

Should be one of the following:

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to our CI configuration files and scripts (example scopes: Circle, BrowserStack, SauceLabs)
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests
  • misc: Adding miscellaneous items

Scope

There's no specific recommendations for naming scope yet. Feel free to write your own scopes.

Subject

The subject contains a succinct description of the change:

  • use the imperative, present tense: "change" not "changed" nor "changes"
  • do capitalize the first letter
  • no dot (.) at the end

Body

Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes". If the commit derives changes from previous behavior, the body should include the motivation for the change and contrast this with previous behavior.

Footer

The footer should contain any information about Breaking Changes and is also the place to

Branch Management

I use git-flow to manage branches. For branch history, see the branches on this repository.

Contributing

Member of SPARCS-KAIST can freely contribute on this repository.

Versioning

I use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

We're renewing following projects.

Zabo-WEB and Zabo-API