Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: cd nodeServer
- run: npm install
- run: npm dev
- run: |
echo "PORT=$PORT" >> .env
echo "JWT_SECRET=$JWT_SECRET" >> .env
echo "NODEMAILER_USER=$NODEMAILER_USER" >> .env
echo "NODEMAILER_PASSWORD=$NODEMAILER_PASSWORD" >> .env
echo "DB_URL=$DB_URL" >> .env
npm install --prefix ./nodeServer
npm run dev --prefix ./nodeServer
env :
PORT: ${{ secrets.PORT }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
NODEMAILER_USER: ${{ secrets.NODEMAILER_USER }}
NODEMAILER_PASSWORD: ${{ secrets.NODEMAILER_PASSWORD }}
DB_URL: ${{ secrets.DB_URL }}
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
# helloPlantNodeServer

api-doc : http://18.116.203.236:1234/api-docs/
api-doc : http://3.12.148.142/api-docs/

## Scripts

### `npm start`

Non-disruptive deployment to the server using pm2

### `npm run dev`

You can test it at the time of development using nodemon.

### `npm run api-docs`

You can just fix api-docs<br>
this script runs before `npm start` and `npm run dev`
### `docker-compose up`

2 changes: 1 addition & 1 deletion nodeServer/build/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ info:
title: HelloPlant api
contact:
email: qwerq123456@snu.ac.kr
basePath: '/18.116.203.236:1234'
basePath: /3.12.148.142/
schemes:
- http
tags:
Expand Down
4 changes: 2 additions & 2 deletions nodeServer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ services:
image: mongo
restart : always
environment :
- MONGO_INITDB_ROOT_USERNAME=my-username
- MONGO_INITDB_ROOT_PASSWORD=my-root-password
- MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
ports:
- "27017:27017"
volumes :
Expand Down
2 changes: 0 additions & 2 deletions nodeServer/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec))


app.use(session({
// todo : put it in .env
secret: 'secret',
resave: false,
saveUninitialized: true,
Expand All @@ -43,7 +42,6 @@ app.use(passport.initialize());

app.use('/', router);

// todo : put port in .env
app.listen('5000', () => {
console.log(`
################################################
Expand Down
6 changes: 2 additions & 4 deletions nodeServer/src/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import mongoose from 'mongoose';
import dotenv from 'dotenv';

dotenv.config();

const DB_URL = process.env.DB_URL as string;
mongoose.connect(
"mongodb://my-username:my-root-password@mongo:27017"
// process.env.DB_URL as string,
// "mongodb+srv://qwerq123456:rudghks123@cluster0.nyhkg.mongodb.net/myFirstDatabase?retryWrites=true&w=majority"
DB_URL
);
const db = mongoose.connection;

Expand Down
2 changes: 1 addition & 1 deletion nodeServer/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const router = express.Router();
router.get('/test', (req,res)=>{
res.sendStatus(200);
});
router.get('/deploy-test1', (req,res) => {
router.get('/deploy-test3', (req,res) => {
res.sendStatus(200);
})

Expand Down
2 changes: 1 addition & 1 deletion nodeServer/src/swagger/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ info:
# put the contact info for your development or API team
contact:
email: qwerq123456@snu.ac.kr
basePath: /18.116.203.236:1234
basePath: /3.12.148.142/
schemes:
- http

Expand Down