File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Zappify CI
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ jobs :
8+ build :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout code
13+ uses : actions/checkout@v3
14+
15+ - name : Setup Node
16+ uses : actions/setup-node@v3
17+ with :
18+ node-version : 18
19+
20+ - name : Install dependencies
21+ run : npm install
22+
23+ - name : Run app (test)
24+ run : node index.js
25+
26+ - name : Build Docker image
27+ run : docker build -t zappify-app .
Original file line number Diff line number Diff line change 1+ node_modules /
2+ package-lock.json
3+ zappify@1.0.0
4+ .env
Original file line number Diff line number Diff line change 1+ FROM node:18
2+
3+ WORKDIR /app
4+
5+ COPY package*.json ./
6+ RUN npm install
7+
8+ COPY . .
9+
10+ EXPOSE 3000
11+
12+ CMD ["npm" , "run" , "dev" ]
Original file line number Diff line number Diff line change 1+ const express = require ( "express" ) ;
2+
3+ const app = express ( ) ;
4+ const PORT = 3000 ;
5+
6+
7+ app . use ( express . json ( ) ) ;
8+
9+
10+ app . get ( "/" , ( req , res ) => {
11+ res . send ( "Zappify Backend Running 🚀" ) ;
12+ } ) ;
13+
14+
15+ app . get ( "/api" , ( req , res ) => {
16+ res . json ( { message : "Hello Devendra " } ) ;
17+ } ) ;
18+
19+
20+ app . post ( "/data" , ( req , res ) => {
21+ const data = req . body ;
22+ res . json ( {
23+ message : "Data received " ,
24+ data : data ,
25+ } ) ;
26+ } ) ;
27+
28+
29+ app . listen ( PORT , ( ) => {
30+ console . log ( `Server running on http://localhost:${ PORT } ` ) ;
31+ } ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " zappify" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " " ,
5+ "main" : " index.js" ,
6+ "scripts" : {
7+ "dev" : " node index.js" ,
8+ "start" : " node index.js" ,
9+ "test" : " echo \" Error: no test specified\" && exit 1"
10+ },
11+ "repository" : {
12+ "type" : " git" ,
13+ "url" : " git+https://github.com/Mishra-coder/Zappify.git"
14+ },
15+ "keywords" : [],
16+ "author" : " " ,
17+ "license" : " ISC" ,
18+ "type" : " commonjs" ,
19+ "bugs" : {
20+ "url" : " https://github.com/Mishra-coder/Zappify/issues"
21+ },
22+ "homepage" : " https://github.com/Mishra-coder/Zappify#readme" ,
23+ "dependencies" : {
24+ "express" : " ^5.2.1"
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments