Skip to content
Snippets Groups Projects
Commit 0538e38d authored by Chao Zhan's avatar Chao Zhan
Browse files

remove code

parent 63a45a31
No related branches found
No related tags found
No related merge requests found
node_modules
npm-debug.log
FROM node:18
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm ci --omit=dev
# Bundle app source
COPY . .
EXPOSE 8080
CMD [ "node", "index.js" ]
const express = require('express')
const app = express()
// Constants
const PORT = 8080
const HOST = '0.0.0.0'
// Route handler for the home page
app.get('/', (req, res) => {
res.send('<p>Hello World!</p>')
})
// Route handler for the about page
app.get('/about', (req, res) => {
res.send('About page')
})
// Route handler for a dynamic URL
app.get('/users/:id', (req, res) => {
const userId = req.params.id
res.send(`User ID: ${userId}`)
})
// Start the server
app.listen(PORT, HOST, () => {
console.log(`Running on http://${HOST}:${PORT}`)
})
This diff is collapsed.
{
"name": "express-demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.2"
}
}
import xmlrpc.client
server = xmlrpc.client.ServerProxy("http://0.0.0.0:8000")
with server as proxy:
result = proxy.square(5)
print("[RPC] The square of 5 is:", result)
result = proxy.cube(5)
print("[RPC] The cube of 5 is:", result)
import xmlrpc.server
class MyServer:
def square(self, x):
return x * x
def cube(self, x):
return x * x * x
server = xmlrpc.server.SimpleXMLRPCServer(("0.0.0.0", 8000))
print("Listening on port 8000...")
server.register_instance(MyServer())
server.serve_forever()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment