Tools and Configurations:
- TypeScript 4.3
- Type definitions for Node.js
- Prettier to enforce consistent code style
- NPM scripts for common operations
- Reproducible environments thanks to Volta
This project is intended to be used with the latest Active LTS release of Node.js.
To clone the repository, use the following commands:
git clone https://github.com/marndt26/SobS_Web
cd SobS_Web
npm install
Volta is used to ensure that all team members are using the same javascript tooling and environments.
- For more info see Volta
for Unix environment, Install with one command:
curl https://get.volta.sh | bash
npm i
npm audit
ornpm audit fix
if needed
npm run build
→ for building the projectnpm run watch
→ for starting server in development modenpm run start
→ for starting server in production mode
- Select
VS Code
->View
->Command Palette
, and type: Format Document With - Then
Configure Default Formatter
... and then choosePrettier - Code formatter
.
npm i -g typescript
For testing the server with the microcontroller, it is helpful to expose the localhost server to the internet. Cloudflare is a server that allows for this. More information can be found here
To start the tunnel:
npm run watch
cloudflared tunnel --url localhost:3000
This project used a MongoDB backend database. To interact with the local version of the database, you can use mongosh.
-
WSL
- Follow this tutorial
- may need this command
sudo chown -R
id -undata/db
- also may need to delete
sudo rm /tmp/mongodb-27017.sock
to fix a permissions issue
start mongod:
mongod --dbpath /data/db
mongosh:
use | command | description |
---|---|---|
connect | mongosh |
connect to mongo shell (must have already started mongod in another process) |
navigation | use <db-name> |
equivalent to cd into a database directory |
list | db.<collection>.find({"doc_property": "query"}) |
equivalent to ls for a database collection with an optional query parameter |
delete | db.<collection>.deleteOne({"doc_property":"query"}) |
equivalent to a rm with a query parameter for a certain doc property |
delete all | db.<collection>.deleteMany({}) |
removes all documents in a collection |
for more information view the MongoDB documentation
start
- deploy application,build
- build application,dev
- start application in development mode with live server reload- TODO: NEEDS UPDATING: THERE ARE MANY MORE (SEE PACKAGE.JSON)
- Heroku Typescript Getting Started
NOTE
This was the original template used but has since been updated to the Typescript Node Starter below
- TypeScript Node Starter
- Fireship.io TS Tutorial
- Boilerplate Code
- Websocket Typescript Example
- Plant UML
- Friend Requests
- 3D Models:
- Install Node Binaries
- create powershell alias for node
echo $profile
to find where powershell profile is located- create/modify file to include the following:
- Set-Alias -Name node -Value C:\path\to\node.exe
- Set-Alias -Name npm -Value C:\path\to\npm.cmd
- Set-Alias -Name npx -Value C:\path\to\npx.cmd
- Add
.npmrc
file to root of project folder with the following linescripts-prepend-node-path=true
Licensed under the APLv2. See the LICENSE file for details.