Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nwylynko/connect420-server
server for connect420, written in typescript with nodejs, socketio and redis
https://github.com/nwylynko/connect420-server
Last synced: 22 days ago
JSON representation
server for connect420, written in typescript with nodejs, socketio and redis
- Host: GitHub
- URL: https://github.com/nwylynko/connect420-server
- Owner: NWylynko
- Created: 2020-04-06T01:41:59.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T09:49:32.000Z (about 2 years ago)
- Last Synced: 2024-11-02T15:04:40.443Z (2 months ago)
- Language: TypeScript
- Homepage: https://connect420.web.app
- Size: 1.28 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# connect420-server
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/24cbb478ff744dadaee6771b8e82ff5b)](https://app.codacy.com/manual/nick1014375/connect420-server?utm_source=github.com&utm_medium=referral&utm_content=NWylynko/connect420-server&utm_campaign=Badge_Grade_Dashboard)
Server for connect420, written in typescript with nodejs, socketio and redis.
# dependencies
- node 14
- npm 6
- redis 6
- docker (if deploying through it)# to use
1. `git clone https://github.com/NWylynko/connect420-server` # get the code
2. `cd connect420-server` # change directory to it
2. `yarn` # install dependecies## to develop
3. `yarn watch` # watch code and rebuild after changes
## to build
3. `yarn build` # build into normal javascript
# using docker
```
docker run -d \
--name state \
--expose 6379 \
redisdocker run -d \
-p 3001:3001 \
-env REDIS_URL=redis://state \
-env PORT=3001 \
--name connect420-server \
nwylynko/connect420-server
```- using docker-compose:
```
version: "3"
services:
c420-server:
image: nwylynko/connect420-server
container_name: c420-server
ports:
- 3001:3001
environment:
- REDIS_URL=redis://state
depends_on:
- redisredis:
image: redis
container_name: state
expose:
- 6379
```# environment variables
### can be defined from a .env file, set in a docker-compose under environment, exported straight to the shell, etc
- PORT - default 3001 - tells server what port to listen on for http and ws (socketio) requests / connections
- NODE_ENV - either 'production' or 'development' - run the server either in production or development mode
- REDIS_URL - default redis://localhost:6379 - tells the server where the redis server is running
- CORS - default ["http://localhost:3000"] - set to an array of origins (the url the client is hosted at) otherwise the client wont be able to connect // make sure to use " instead of ' as json parser will through an error on '
- CORS_ALLOW_UNKNOWN_ORIGIN - 'true' or 'false' (false if undefined / by default) - allows http request from from an unknown origin, most likely when someone goes to the api in a browser instead of a the request coming from the hosted client website itself