当前位置:网站首页>Hello world of vertx
Hello world of vertx
2022-07-03 07:25:00 【Sleeping Empire】
1. maven Project dependence
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web</artifactId>
</dependency>
2. Project part code
public class MainVerticle extends AbstractVerticle {
@Override
public void start(Promise<Void> startPromise) throws Exception {
vertx.createHttpServer().requestHandler(req ->
req.response()
.putHeader("content-type", "text/plain")
.end("Hello from Vert.x!")
).listen(8888, http -> {
if (http.succeeded()) {
startPromise.complete();
System.out.println("HTTP server started on port 8888");
} else {
startPromise.fail(http.cause());
}
});
}
}
Project start item
public class HelloWorldApplication {
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(MainVerticle.class.getName());
}
}
3. Project test
After the project starts , Enter the address in the browser :http://127.0.0.1:8888; You can see the page information :Hello from Vert.x!
4. Full address of the project
边栏推荐
- 7.2刷题两个
- 4everland: the Web3 Developer Center on IPFs has deployed more than 30000 dapps!
- Gridome + strapi + vercel + PM2 deployment case of [static site (3)]
- 7.2 brush two questions
- Spa single page application
- II. D3.js draw a simple figure -- circle
- TypeScript let与var的区别
- 【最詳細】最新最全Redis面試大全(50道)
- C code production YUV420 planar format file
- Advanced API (local simulation download file)
猜你喜欢

Basic components and intermediate components

SecureCRT取消Session记录的密码

Store WordPress media content on 4everland to complete decentralized storage

Common APIs

Arduino Serial系列函数 有关print read 的总结

“百度杯”CTF比赛 2017 二月场,Web:爆破-1

High concurrency memory pool

Hash table, generic

Spa single page application

Interview questions about producers and consumers (important)
随机推荐
Summary of Arduino serial functions related to print read
Jeecg menu path display problem
[set theory] order relation (partial order relation | partial order set | example of partial order set)
[solved] sqlexception: invalid value for getint() - 'Tian Peng‘
【已解决】Unknown error 1146
为什么说数据服务化是下一代数据中台的方向?
万卷书 - 价值投资者指南 [The Education of a Value Investor]
2. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
2021-07-18
Use of file class
Gridome + strapi + vercel + PM2 deployment case of [static site (3)]
萬卷書 - 價值投資者指南 [The Education of a Value Investor]
Operation and maintenance technical support personnel have hardware maintenance experience in Hong Kong
MySQL syntax (basic)
SecureCRT password to cancel session recording
Common analysis with criteria method
HISAT2 - StringTie - DESeq2 pipeline 进行bulk RNA-seq
Raspberry pie update tool chain
Basic components and intermediate components
Chrome 98 Private Network Access problem w/ disabled web security: Request had no target IP address